Skip to content

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

Fixing adding multiple tags

uggrock546bda6bde49
diff --git a/data/js/settings.api.js b/data/js/settings.api.js
index 8b45b2f95..8a4fc8183 100644
--- a/data/js/settings.api.js
+++ b/data/js/settings.api.js
@@ -447,10 +447,6 @@ define(function(require, exports, module) {
};
var createTag = function(tagData, newTagName, newTagColor, newTagTextColor) {
- var newTagModel = JSON.parse( JSON.stringify(tagTemplate) );
- newTagModel.title = newTagName;
- newTagModel.color = newTagColor;
- newTagModel.textcolor = newTagTextColor;
exports.Settings["tagGroups"].forEach(function (value, index) {
if(value.key == tagData.key) {
console.log("Creating tag: "+JSON.stringify(newTagModel)+" with parent: "+tagData.key);
@@ -461,11 +457,15 @@ define(function(require, exports, module) {
}
});
// Create tag if it is not existing in the current group
- // And is at least 3 characters long
- if(!tagExistsInGroup && (newTagName.length > 2)) {
+ // And is at least 2 characters long
+ if(!tagExistsInGroup && (newTagName.length >= 2)) {
+ var newTagModel = JSON.parse( JSON.stringify(tagTemplate) );
+ newTagModel.title = newTagName;
+ newTagModel.color = newTagColor;
+ newTagModel.textcolor = newTagTextColor;
value["children"].push(newTagModel);
} else {
- console.log("Tag with the same name already exist in this group or tag length < 3");
+ console.log("Tag with the same name already exist in this group or tag length >= 2");
}
}
});