Merge pull request #343 from ZmagoD/zd_SCI_780

fixed step description links [fixes SCI-780]
This commit is contained in:
Zmago Devetak 2016-12-15 13:12:25 +01:00 committed by GitHub
commit daee14bed5
2 changed files with 16 additions and 0 deletions

View file

@ -80,6 +80,7 @@ function applyCancelCallBack() {
setTimeout(function() { setTimeout(function() {
initStepsComments(); initStepsComments();
openLinksInNewTab();
}, 1000); }, 1000);
}) })
@ -111,6 +112,7 @@ function applyEditCallBack() {
$("#new-step-main-tab a").on("shown.bs.tab", function() { $("#new-step-main-tab a").on("shown.bs.tab", function() {
$("#step_name").focus(); $("#step_name").focus();
}); });
openLinksInNewTab();
}); });
} }
@ -181,6 +183,7 @@ function formCallback($form) {
setTimeout(function() { setTimeout(function() {
initStepsComments(); initStepsComments();
openLinksInNewTab();
}, 1000); }, 1000);
return true; return true;
}); });

View file

@ -1,5 +1,6 @@
//= require quill //= require quill
// Globally overwrite links handling in Quill rich text editor // Globally overwrite links handling in Quill rich text editor
var Link = Quill.import('formats/link'); var Link = Quill.import('formats/link');
Link.sanitize = function(url) { Link.sanitize = function(url) {
@ -8,3 +9,15 @@ Link.sanitize = function(url) {
} }
return 'http://' + url; return 'http://' + url;
}; };
function openLinksInNewTab() {
_.each($('.ql-editor a'), function(el) {
if ($(el).attr('target') !== '_blank') {
$(el).attr('target', '_blank');
}
});
}
$(document).ready(function(){
openLinksInNewTab();
});