Skip to content

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

Added recent tag collect method

Borislav Sapundzhiev68d8a9fbfbc1
diff --git a/data/js/tagutils.js b/data/js/tagutils.js
index 66746be3d..fd0c53880 100644
--- a/data/js/tagutils.js
+++ b/data/js/tagutils.js
@@ -346,6 +346,7 @@ define(function(require, exports, module) {
}
var newFileName = generateFileName(fileName, extractedTags);
TSCORE.IO.renameFile(filePath, containingDirectoryPath + TSCORE.dirSeparator + newFileName);
+ collectRecentTags(tags);
}
function removeTagsFromFile(filePath, tags) {
@@ -475,6 +476,31 @@ define(function(require, exports, module) {
TSCORE.IO.renameFile(filePath, containingDirectoryPath + TSCORE.dirSeparator + newFileName);
}
+ //Collect recent tags to gorup
+ //TODO: UI is not refreshed
+ function collectRecentTags (newTags) {
+
+ var collectGroupKey = 'COL';
+ var collectGroup = TSCORE.Config.getTagGroupData(collectGroupKey);
+ if (!collectGroup) {
+
+ var collectGroupTemplate = {
+ 'title': 'Collected Tags',
+ 'key': collectGroupKey,
+ 'expanded': true,
+ 'children': []
+ };
+
+ TSCORE.Config.addTagGroup(collectGroupTemplate);
+ TSCORE.Config.saveSettings();
+ collectGroup = collectGroupTemplate;
+ }
+
+ newTags.forEach(function(newTagName) {
+ TSCORE.Config.createTag(collectGroup, newTagName);
+ });
+ }
+
// Public API definition
exports.beginTagContainer = BEGIN_TAG_CONTAINER;
exports.endTagContainer = END_TAG_CONTAINER;