1
0
Fork 0
mirror of https://github.com/marty-oehme/scripts.git synced 2024-12-22 07:58:08 +00:00

added tag autocompletion

This commit is contained in:
Patrizio Bekerle 2018-02-03 12:52:17 +01:00
parent f247d6857c
commit 0dd8cf892a
No known key found for this signature in database
GPG key ID: 2E9FFD770DABE838
2 changed files with 18 additions and 2 deletions

View file

@ -155,4 +155,20 @@ Script {
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}
/**
* Hook to feed the autocompletion with tags if the current word starts with the tag marker
*/
function autocompletionHook() {
// get the current word plus non-word-characters before the word to also get the tag marker
var word = script.noteTextEditCurrentWord(true);
if (!word.startsWith(tagMarker)) {
return [];
}
// cut the tag marker off of the string and do a substring search for tags
var tags = script.searchTagsByName(word.substr(tagMarker.length));
return tags;
}
}

View file

@ -4,7 +4,7 @@
"script": "in-note-text-tagging.qml",
"authors": ["@pbek", "@Maboroshy"],
"platforms": ["linux", "macos", "windows"],
"version": "0.0.5",
"version": "0.0.6",
"minAppVersion": "17.09.9",
"description" : "With this script you can <b>store your tags in your note-text</b>. Use tags like <i>@tag</i> or <i>@tag_one</i> for 'tag one' inside your note-text to tag your notes. You can change '@' to something else in script settings.\n\nYou also are able to use the functionality of the QOwnNotes user-interface to tag with this tags inside your note texts, like for adding a tag to the current note as well as bulk operations for adding and removing tags to your note. If you rename a tag inside QOwnNotes the text-tags in your notes are also updated.\n\nYou can also use this script as template for implementing your own, unique tagging mechanism.\n\n<b>If you install this script you will loose all links between notes and tags and instead your in-note tags will be used!\n\nThis functionality is still experimental!</b>\nPlease report your experiences."
"description" : "With this script you can <b>store your tags in your note-text</b>. Use tags like <i>@tag</i> or <i>@tag_one</i> for 'tag one' inside your note-text to tag your notes. You can change '@' to something else in script settings.\n\nYou also are able to use the functionality of the QOwnNotes user-interface to tag with this tags inside your note texts, like for adding a tag to the current note as well as bulk operations for adding and removing tags to your note. If you rename a tag inside QOwnNotes the text-tags in your notes are also updated.\n\nIf you start writing a tag you can also use the autocompleter to get a list of already existing tags.\n\nYou can also use this script as template for implementing your own, unique tagging mechanism.\n\n<b>If you install this script you will loose all links between notes and tags and instead your in-note tags will be used!\n\nThis functionality is still experimental!</b>\nPlease report your experiences."
}