fixed step description links [fixes SCI-780]

This commit is contained in:
zmagod 2016-12-09 15:26:41 +01:00
parent 310b61ec12
commit e23be6cc0e
2 changed files with 17 additions and 0 deletions

View file

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

View file

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