mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
open external links
This commit is contained in:
parent
c9294897f7
commit
e2cd4dca19
1 changed files with 16 additions and 1 deletions
|
|
@ -85,7 +85,7 @@
|
|||
};
|
||||
}();
|
||||
|
||||
habitrpg.directive('markdown', ['$timeout', function($timeout) {
|
||||
habitrpg.directive('markdown', ['$timeout','MOBILE_APP', function($timeout, MOBILE_APP) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link: function(scope, element, attrs) {
|
||||
|
|
@ -107,6 +107,21 @@
|
|||
html = html.replace(' href',' target="'+linktarget+'" href');
|
||||
element.html(html);
|
||||
|
||||
if(MOBILE_APP) {
|
||||
var elements = element.find("a");
|
||||
_.forEach(elements, function(link){
|
||||
if(link.href) {
|
||||
|
||||
link.onclick = function (e) {
|
||||
scope.externalLink(this.href);
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(removeWatch)
|
||||
{
|
||||
doRemoveWatch();
|
||||
|
|
|
|||
Loading…
Reference in a new issue