Skip to content

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

adding file download functionality adding scrolling to the tag suggesion menu improving open in new windows functionality to support web

Ilianca0e7b5604c4
diff --git a/data/js/fileopener.js b/data/js/fileopener.js
index 04ec8e845..394b4f171 100644
--- a/data/js/fileopener.js
+++ b/data/js/fileopener.js
@@ -39,7 +39,7 @@
$( "#saveDocument" )
.click(function() {
saveFile();
- });
+ });
$( "#closeOpenedFile" )
.click(function() {
@@ -73,7 +73,15 @@
$( "#openFileInNewWindow" )
.click(function() {
- window.open("file:///"+_openedFilePath);
+ if(isWeb) {
+ if(location.port === "") {
+ window.open(location.protocol+"//"+location.hostname+_openedFilePath);
+ } else {
+ window.open(location.protocol+"//"+location.hostname+":"+location.port+_openedFilePath);
+ }
+ } else {
+ window.open("file:///"+_openedFilePath);
+ }
});
$( "#printFile" )
@@ -218,6 +226,18 @@
_openedFilePath = filePath;
//$("#selectedFilePath").val(_openedFilePath.replace("\\\\","\\"));
+ if(isWeb) {
+ var downloadLink;
+ if(location.port === "") {
+ downloadLink = location.protocol+"//"+location.hostname+_openedFilePath;
+ } else {
+ downloadLink = location.protocol+"//"+location.hostname+":"+location.port+_openedFilePath;
+ }
+ $( "#downloadFile").attr("href",downloadLink).attr("download",TSCORE.TagUtils.extractFileName(_openedFilePath));
+ } else {
+ $( "#downloadFile").attr("href","file:///"+_openedFilePath).attr("download",TSCORE.TagUtils.extractFileName(_openedFilePath));
+ }
+
var fileExt = TSCORE.TagUtils.extractFileExtension(filePath);
// TODO Improve preventing opening of directories
@@ -432,6 +452,7 @@
var tsMenu = $( "#tagSuggestionsMenu" );
tsMenu.empty();
+ tsMenu.attr("style","overflow-y: auto; max-height: 500px;");
tsMenu.append($('<li>', {
class: "dropdown-header",
text: $.i18n.t("ns.common:tagOperations")