Skip to content

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

adding keybinding for tags

Ilian88f2723a6840
diff --git a/data/js/tags.ui.js b/data/js/tags.ui.js
index a9ac2de8a..29a1f4dd2 100644
--- a/data/js/tags.ui.js
+++ b/data/js/tags.ui.js
@@ -274,13 +274,18 @@
if(tag.type === "smart"){
tagIcon = "<span class='fa fa-flask'/> ";
}
- // TODO Add keybinding to tags
-// if(tag.keyBinding !== undefined) {
-// tagIcon = "<span class='fa fa-key'/> ";
-// Mousetrap.bind(tag.keyBinding, (function(innerTag) {
-// TSCORE.TagUtils.addTag(TSCORE.selectedFiles, [innerTag]);
-// } (tag.title) ));
-// }
+ // Add keybinding to tags
+ if(tag.keyBinding !== undefined) {
+ tagIcon = "<span class='fa fa-key'/> ";
+ Mousetrap.bind(
+ tag.keyBinding,
+ (function(innerTag) {
+ return function( e ) {
+ TSCORE.TagUtils.addTag(TSCORE.selectedFiles, [innerTag]);
+ };
+ })(tag.title)
+ );
+ }
var tagCount = "";
if(tag.count !== undefined) {
tagCount = " ("+tag.count+")";