TagSpaces is an offline, open source, document manager with tagging support
keeping selection on file rename
uggrock3bffd7190055
diff --git a/data/ext/perspectiveGrid/perspectiveUI.js b/data/ext/perspectiveGrid/perspectiveUI.jsindex 25803aa6d..db9ef738c 100644--- a/data/ext/perspectiveGrid/perspectiveUI.js+++ b/data/ext/perspectiveGrid/perspectiveUI.js@@ -51,7 +51,7 @@ console.log("Loading UI for perspectiveDefault");<button class="btn btn-sm tagButton fileTagsTile" tag="{{tag}}" filepath="{{filepath}}" style="{{style}}">{{tag}} <span class="caret"></span></button>\{{/each}}\</span><span class="fileExtTile">{{fileext}}</span>\- <button class="btn btn-link fileTileSelector" filepath="{{filepath}}"><i class="fa fa-square-o fa-lg"></i></button></p></li>');+ <button class="btn btn-link fileTileSelector" filepath="{{filepath}}"><i class="fa {{selected}} fa-lg"></i></button></p></li>');var fileTileTmbTmpl = Handlebars.compile('<li title="{{filepath}}" filepath="{{filepath}}" class="fileTile">\<span><img class="thumbImgTile" filepath="{{tmbpath}}" style="max-width: 200px; max-height: 200px;" src=""></span>\@@ -60,9 +60,9 @@ console.log("Loading UI for perspectiveDefault");<button class="btn btn-sm tagButton fileTagsTile" tag="{{tag}}" filepath="{{filepath}}" style="{{style}}">{{tag}} <span class="caret"></span></button>\{{/each}}\</span><span class="fileExtTile">{{fileext}}</span>\- <button class="btn btn-link fileTileSelector" filepath="{{filepath}}"><i class="fa fa-square-o fa-lg"></i></button></p></li>');+ <button class="btn btn-link fileTileSelector" filepath="{{filepath}}"><i class="fa {{selected}} fa-lg"></i></button></p></li>');- ExtUI.prototype.createFileTile = function(title, filePath, fileExt, fileTags) {+ ExtUI.prototype.createFileTile = function(title, filePath, fileExt, fileTags, isSelected) {//TODO minimize platform specific callsvar tmbPath = undefined;if(isCordova || isWeb) {@@ -76,7 +76,8 @@ console.log("Loading UI for perspectiveDefault");tmbpath: tmbPath,fileext: fileExt,title: title,- tags : []+ tags : [],+ selected: isSelected?"fa-check-square-o":"fa-square-o"};if(fileTags.length > 0) {@@ -651,6 +652,9 @@ console.log("Loading UI for perspectiveDefault");ExtUI.prototype.removeFileUI = function(filePath) {console.log("Removing "+filePath+" from UI");+ // Updating the file selection+ TSCORE.selectedFiles.splice(TSCORE.selectedFiles.indexOf(oldFilePath), 1);+if(isWin && !isWeb) {filePath = filePath.replace("\\","");$("#"+this.extensionID+"Container li[filepath]").each(function() {@@ -665,6 +669,11 @@ console.log("Loading UI for perspectiveDefault");ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {console.log("Updating file in UI");++ // Updating the file selection+ TSCORE.selectedFiles.splice(TSCORE.selectedFiles.indexOf(oldFilePath), 1);+ TSCORE.selectedFiles.push(newFilePath);+var title = TSCORE.TagUtils.extractTitle(newFilePath),fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),fileTags = TSCORE.TagUtils.extractTags(newFilePath);@@ -682,7 +691,7 @@ console.log("Loading UI for perspectiveDefault");$fileTile = $("#"+this.extensionID+"Container li[filepath='"+oldFilePath+"']");}- $fileTile.replaceWith(this.createFileTile(title, newFilePath, fileExt, fileTags));+ $fileTile.replaceWith(this.createFileTile(title, newFilePath, fileExt, fileTags, true));this.refreshThumbnails();this.assingFileTileHandlers($fileTile);};diff --git a/data/ext/perspectiveList/perspectiveUI.js b/data/ext/perspectiveList/perspectiveUI.jsindex 044a976b8..886a9e92e 100644--- a/data/ext/perspectiveList/perspectiveUI.js+++ b/data/ext/perspectiveList/perspectiveUI.js@@ -409,15 +409,15 @@ console.log("Loading UI for perspectiveList");this.refreshThumbnails();};- var buttonCompTmpl = Handlebars.compile('<button filepath="{{filepath}}" class="btn btn-link fileSelection"><i class="fa fa-square-o fa-fw fa-lg"></i></button>' ++ var buttonCompTmpl = Handlebars.compile('<button filepath="{{filepath}}" class="btn btn-link fileSelection"><i class="fa {{selected}} fa-fw fa-lg"></i></button>' +'<button filepath="{{filepath}}" class="btn btn-link fileTitleButton"><span class="fileExt"><span>{{fileext}}</span> <span class="caret white-caret"></span></span></button>');- var buttonCompTmbTmpl = Handlebars.compile('<button filepath="{{filepath}}" class="btn btn-link fileSelection"><i class="fa fa-square-o fa-fw fa-lg"></i></button>' ++ var buttonCompTmbTmpl = Handlebars.compile('<button filepath="{{filepath}}" class="btn btn-link fileSelection"><i class="fa {{selected}} fa-fw fa-lg"></i></button>' +'<button filepath="{{filepath}}" class="btn btn-link fileTitleButton"><span class="fileExt"><span>{{fileext}}</span> <span class="caret white-caret"></span></span></button>' +'<br><img class="thumbImg" filepath="{{tmbpath}}" style="width: 0; height: 0; border: 0" src="">');// Helper function user by basic and search views- ExtUI.prototype.buttonizeTitle = function(title, filePath, fileExt) {+ ExtUI.prototype.buttonizeTitle = function(title, filePath, fileExt, isSelected) {if(title.length < 1) {title = filePath;}@@ -433,7 +433,8 @@ console.log("Loading UI for perspectiveList");var context = {filepath: filePath,tmbpath: tmbPath,- fileext: fileExt+ fileext: fileExt,+ selected: isSelected?"fa-check-square-o":"fa-square-o"};if(supportedFileTypeThumnailing.indexOf(fileExt) >= 0) {@@ -566,6 +567,9 @@ console.log("Loading UI for perspectiveList");ExtUI.prototype.removeFileUI = function(filePath) {console.log("Removing from UI"+filePath+" from UI");+ // Updating the file selection+ TSCORE.selectedFiles.splice(TSCORE.selectedFiles.indexOf(oldFilePath), 1);+var row4remove;if(isWin && !isWeb) {filePath = filePath.replace("\\","");@@ -584,7 +588,11 @@ console.log("Loading UI for perspectiveList");ExtUI.prototype.updateFileUI = function(oldFilePath, newFilePath) {console.log("Updating UI for oldfile "+oldFilePath+" newfile "+newFilePath);-++ // Updating the file selection+ TSCORE.selectedFiles.splice(TSCORE.selectedFiles.indexOf(oldFilePath), 1);+ TSCORE.selectedFiles.push(newFilePath);+var title = TSCORE.TagUtils.extractTitle(newFilePath),fileExt = TSCORE.TagUtils.extractFileExtension(newFilePath),fileTags = TSCORE.TagUtils.extractTags(newFilePath);@@ -602,7 +610,7 @@ console.log("Loading UI for perspectiveList");$fileRow = $("#"+this.extensionID+"Container button[filepath='"+oldFilePath+"']").parent().parent();}- $($fileRow.find("td")[0]).empty().append(this.buttonizeTitle(title,newFilePath,fileExt));+ $($fileRow.find("td")[0]).empty().append(this.buttonizeTitle(title,newFilePath,fileExt,true));$($fileRow.find("td")[1]).text(title);$($fileRow.find("td")[2]).empty().append(TSCORE.generateTagButtons(fileTags,newFilePath));