diff --git a/addons/linkify/linkify.js b/addons/linkify/linkify.js
index 04cfe189..1d3ffaf5 100644
--- a/addons/linkify/linkify.js
+++ b/addons/linkify/linkify.js
@@ -54,10 +54,11 @@
* "linkified".
* @param {boolean} lenient - The regex type that will be used to identify links. If lenient is
* false, the regex requires a protocol clause. Defaults to true.
+ * @param {string} target - Sets target="" attribute with value provided to links. Defaults to '_self'
* @emits linkify
* @emits linkify:line
*/
- exports.linkifyTerminalLine = function (terminal, line, lenient) {
+ exports.linkifyTerminalLine = function (terminal, line, lenient, target) {
if (typeof line == 'number') {
line = terminal.rowContainer.children[line];
} else if (! (line instanceof HTMLDivElement)) {
@@ -67,6 +68,8 @@
throw new TypeError(message);
}
+ if (typeof target === 'undefined') target = '_self';
+
var buffer = document.createElement('span'),
nodes = line.childNodes;
@@ -100,7 +103,7 @@
var startsWithProtocol = new RegExp('^' + protocolClause),
urlHasProtocol = url.match(startsWithProtocol),
href = (urlHasProtocol) ? url : 'http://' + url,
- link = '' + url + '',
+ link = '' + url + '',
newHTML = nodeHTML.replace(url, link);
line.innerHTML = line.innerHTML.replace(nodeHTML, newHTML);
@@ -137,17 +140,18 @@
* @param {Xterm} terminal - The terminal that should get "linkified".
* @param {boolean} lenient - The regex type that will be used to identify links. If lenient is
* false, the regex requires a protocol clause. Defaults to true.
+ * @param {string} target - Sets target="" attribute with value provided to links. Defaults to '_self'
* @emits linkify
* @emits linkify:line
*/
- exports.linkify = function (terminal, lenient) {
+ exports.linkify = function (terminal, lenient, target) {
var rows = terminal.rowContainer.children;
lenient = (typeof lenient == "boolean") ? lenient : true;
for (var i=0; i