2016-11-21 21:09:56 +08:00
|
|
|
//= require quill
|
|
|
|
|
2016-12-09 22:26:41 +08:00
|
|
|
|
2016-11-21 21:09:56 +08:00
|
|
|
// Globally overwrite links handling in Quill rich text editor
|
|
|
|
var Link = Quill.import('formats/link');
|
|
|
|
Link.sanitize = function(url) {
|
|
|
|
if (url.includes('http:') || url.includes('https:')) {
|
|
|
|
return url;
|
|
|
|
}
|
|
|
|
return 'http://' + url;
|
|
|
|
};
|
2016-12-09 22:26:41 +08:00
|
|
|
|
2016-12-14 21:40:56 +08:00
|
|
|
function openLinksInNewTab() {
|
2016-12-09 22:26:41 +08:00
|
|
|
_.each($('.ql-editor a'), function(el) {
|
|
|
|
if ($(el).attr('target') !== '_blank') {
|
|
|
|
$(el).attr('target', '_blank');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
2016-12-14 21:40:56 +08:00
|
|
|
openLinksInNewTab();
|
2016-12-09 22:26:41 +08:00
|
|
|
});
|