fixes #1745 Open links from descriptions in a new window

This commit is contained in:
Anna Bodnia
2016-01-22 17:19:00 +02:00
parent b52467c1fe
commit c9ac895023
7 changed files with 30 additions and 8 deletions

11
dist/swagger-ui.js vendored
View File

@@ -25158,6 +25158,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
this.router = opts.router;
document.addEventListener('click', this.onLinkClick, true);
// Sort APIs
if (opts.swaggerOptions.apisSorter) {
sorterOption = opts.swaggerOptions.apisSorter;
@@ -25292,6 +25293,16 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
clear: function(){
$(this.el).html('');
},
onLinkClick: function (e) {
var el = e.target;
if (el.tagName === 'A') {
if (location.hostname !== el.hostname || location.port !== el.port) {
e.preventDefault();
window.open(el.href, '_blank');
}
}
}
});