Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fixing opening links in the default browser instead of the application #53 in markdown files

Ilian1da57bc2314d
diff --git a/data/ext/viewerBrowser/extension.js b/data/ext/viewerBrowser/extension.js
index f24ace4a2..917f84238 100644
--- a/data/ext/viewerBrowser/extension.js
+++ b/data/ext/viewerBrowser/extension.js
@@ -74,7 +74,7 @@ define(function(require, exports, module) {
if(viewerIframe != undefined) {
viewerIframe.contentWindow.document.write(cleanedContent);
- // disabling the links
+ // making all links open in the user default browser
$(viewerIframe.contentWindow.document).find( "a" ).bind('click', function(e){
e.preventDefault();
TSCORE.openLinkExternally($(this).attr("href"));
diff --git a/data/ext/viewerMD/extension.js b/data/ext/viewerMD/extension.js
index 3896c6133..ab8fef48a 100644
--- a/data/ext/viewerMD/extension.js
+++ b/data/ext/viewerMD/extension.js
@@ -55,7 +55,8 @@ define(function(require, exports, module) {
);
var fileDirectory = TSCORE.TagUtils.extractContainingDirectoryPath(currentFilePath);
-
+
+ // fixing embedding of local images
$('#'+containerElID+" img[src]").each(function(){
var currentSrc = $( this ).attr("src");
if(currentSrc.indexOf("http://") == 0 || currentSrc.indexOf("https://") == 0) {
@@ -63,7 +64,14 @@ define(function(require, exports, module) {
} else {
$( this ).attr("src","file://"+fileDirectory+TSCORE.dirSeparator+currentSrc);
}
- });
+ });
+
+ // making all links open in the user default browser
+ $('#'+containerElID+ " a").bind('click', function(e){
+ e.preventDefault();
+ TSCORE.openLinkExternally($(this).attr("href"));
+ })
+
};
exports.getContent = function() {