mirror of
https://github.com/pbek/QOwnNotes.git
synced 2025-06-28 21:09:52 +00:00
23 lines
670 B
QML
23 lines
670 B
QML
import QtQml 2.0
|
|
import QOwnNotesTypes 1.0
|
|
|
|
/**
|
|
* This script is an example for adding text to the autocompletion list
|
|
*/
|
|
Script {
|
|
/**
|
|
* Hook to feed the autocompletion with tags if the current word starts with an "@"
|
|
*/
|
|
function autocompletionHook() {
|
|
// get the current word plus non-word-characters before the word to also get the "@"-character
|
|
var word = script.noteTextEditCurrentWord(true);
|
|
|
|
if (!word.startsWith("@")) {
|
|
return [];
|
|
}
|
|
|
|
// cut the "@" off of the string and do a substring search for tags
|
|
var tags = script.searchTagsByName(word.substr(1));
|
|
return tags;
|
|
}
|
|
}
|