prefix match for autocomplete attribute search

This commit is contained in:
zadam
2020-05-21 12:05:12 +02:00
parent 75d8627f1c
commit 2e6395ad88
4 changed files with 29 additions and 12 deletions

View File

@@ -27,6 +27,20 @@ class NoteCache {
return this.attributeIndex[`${type}-${name}`] || [];
}
/** @return {Attribute[]} */
findAttributesWithPrefix(type, name) {
const resArr = [];
const key = `${type}-${name}`;
for (const idx in this.attributeIndex) {
if (idx.startsWith(key)) {
resArr.push(this.attributeIndex[idx]);
}
}
return resArr.flat();
}
decryptProtectedNotes() {
for (const note of Object.values(this.notes)) {
note.decrypt();