Skip to content

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

Save thumbnails implementation

Borislav Sapundzhievd8af934c0b00
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.js
index 0625cb859..83d2c4c9b 100644
--- a/data/ext/perspectiveGrid/perspectiveUI.js
+++ b/data/ext/perspectiveGrid/perspectiveUI.js
@@ -307,6 +307,9 @@ define(function(require, exports, module) {
ctx.fillRect(0, 0, canvas.width, canvas.height);
dataURL = canvas.toDataURL("image/png");
imgElement.attr('src', dataURL);
+ if (TSPRO.available) {
+ TSPRO.saveThumbnail(fileURL, dataURL);
+ }
});
});
});
@@ -325,12 +328,12 @@ define(function(require, exports, module) {
imgElement.attr('src', dataURL);
img = null;
canvas = null;
+ if (TSPRO.available) {
+ TSPRO.saveThumbnail(fileURL, dataURL);
+ }
};
img.src = fileURL;
}
- if (TSPRO.available) {
- TSPRO.saveThumbnail(fileURL, dataURL);
- }
}
ExtUI.prototype.disableThumbnails = function() {
diff --git a/data/node-webkit/node-webkit.api.js b/data/node-webkit/node-webkit.api.js
index 59937e023..7f472ce0f 100644
--- a/data/node-webkit/node-webkit.api.js
+++ b/data/node-webkit/node-webkit.api.js
@@ -268,7 +268,7 @@ define(function(require, exports, module) {
TSPOSTIO.createDirectoryTree(directoyTree);
};
- var createDirectory = function(dirPath) {
+ var createDirectory = function(dirPath, dontReloadUI) {
console.log("Creating directory: " + dirPath);
fs.mkdir(dirPath, function(error) {
@@ -276,7 +276,9 @@ define(function(require, exports, module) {
console.log("Creating directory " + dirPath + " failed " + error);
return;
}
- TSPOSTIO.createDirectory(dirPath);
+ if(dontReloadUI !== true) {
+ TSPOSTIO.createDirectory(dirPath);
+ }
});
};
@@ -446,10 +448,10 @@ define(function(require, exports, module) {
});
};
- var saveBinaryFile = function(filePath, content, dontReloadUI) {
+ var saveBinaryFile = function(filePath, content, overWrite, dontReloadUI) {
console.log("Saving binary file: " + filePath);
- if (!fs.existsSync(filePath)) {
+ if (!fs.existsSync(filePath) || overWrite === true) {
fs.writeFile(filePath, arrayBufferToBuffer(content), 'utf8', function(error) {
if (error) {
console.log("Save to file " + filePath + " failed " + error);