Revert "convert entire words as urls or do nothing"

This commit is contained in:
Tor Hveem 2024-06-27 23:38:43 +02:00 committed by GitHub
parent f39fe804b1
commit 23833dbab0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 40 deletions

View File

@ -68,9 +68,7 @@ weechat.filter('conditionalLinkify', ['$filter', function($filter) {
return text;
}
return text.replaceAll(/\S+/g, function (match, p2) {
const result = linkifyStr(match, {
return linkifyStr(text, {
className: '',
attributes: {
rel: 'noopener noreferrer'
@ -84,14 +82,6 @@ weechat.filter('conditionalLinkify', ['$filter', function($filter) {
}
}
});
if (result.endsWith("</a>")) {
return result;
} else {
return match
}
});
};
}]);

View File

@ -30,21 +30,6 @@ describe('Filters', function() {
result = $filter('conditionalLinkify')(url);
expect(result).toEqual(link);
}));
it('convert the entire words to links', angular.mock.inject(function($filter) {
var text = 'weechat.network.connection_timeout',
link = 'weechat.network.connection_timeout',
result = $filter('conditionalLinkify')(text);
expect(result).toEqual(link);
}));
it('linkify parenthesis at the end of an url', angular.mock.inject(function($filter) {
var text = 'http://test.com/(test)',
link = '<a href="http://test.com/(test)" target="_blank" rel="noopener noreferrer">http://test.com/(test)</a>',
result = $filter('conditionalLinkify')(text);
expect(result).toEqual(link);
}));
});
describe('irclinky', function() {