Skip to content

Build your personal knowledge base with Trilium Notes

fix attribute name autocomplete, no tooltip preview on path selection

azivnerdbe0eb3f3a97
diff --git a/src/public/javascripts/dialogs/attributes.js b/src/public/javascripts/dialogs/attributes.js
index fa192ff4da..7d0e2e585a 100644
--- a/src/public/javascripts/dialogs/attributes.js
+++ b/src/public/javascripts/dialogs/attributes.js
@@ -246,7 +246,7 @@ async function showDialog() {
$dialog.dialog({
modal: true,
width: 950,
- height: 500
+ height: 700
});
}
diff --git a/src/public/javascripts/services/tooltip.js b/src/public/javascripts/services/tooltip.js
index 86fc5178e0..61d4623169 100644
--- a/src/public/javascripts/services/tooltip.js
+++ b/src/public/javascripts/services/tooltip.js
@@ -6,10 +6,16 @@ function setupTooltip() {
$(document).tooltip({
items: "body a",
content: function (callback) {
- let notePath = linkService.getNotePathFromLink($(this).attr("href"));
+ const $link = $(this);
+
+ if ($link.hasClass("no-tooltip-preview")) {
+ return;
+ }
+
+ let notePath = linkService.getNotePathFromLink($link.attr("href"));
if (!notePath) {
- notePath = $(this).attr("data-note-path");
+ notePath = $link.attr("data-note-path");
}
if (notePath) {
diff --git a/src/public/javascripts/services/tree.js b/src/public/javascripts/services/tree.js
index 6c75f63878..b0f1fbb5b3 100644
--- a/src/public/javascripts/services/tree.js
+++ b/src/public/javascripts/services/tree.js
@@ -206,7 +206,11 @@ async function showPaths(noteId, node) {
const notePath = parentNotePath ? (parentNotePath + '/' + noteId) : noteId;
const title = await treeUtils.getNotePathTitle(notePath);
- const item = $("<li/>").append(await linkService.createNoteLink(notePath, title));
+ const noteLink = await linkService.createNoteLink(notePath, title);
+
+ noteLink.addClass("no-tooltip-preview");
+
+ const item = $("<li/>").append(noteLink);
if (node.getParent().data.noteId === parentNote.noteId) {
item.addClass("current");
diff --git a/src/services/attributes.js b/src/services/attributes.js
index 949d1884f7..bb42817731 100644
--- a/src/services/attributes.js
+++ b/src/services/attributes.js
@@ -59,17 +59,20 @@ async function createAttribute(attribute) {
}
async function getAttributeNames(type, nameLike) {
- const names = await sql.getColumn(
- `SELECT DISTINCT name
- FROM attributes
- WHERE isDeleted = 0
- AND type = ?
- AND name LIKE '%${utils.sanitizeSql(nameLike)}%'`, [ type ]);
-
- for (const attribute of BUILTIN_ATTRIBUTES) {
- if (attribute.type === type && !names.includes(attribute.name)) {
- names.push(attribute.name);
- }
+ let names;
+
+ if (!nameLike) {
+ names = BUILTIN_ATTRIBUTES
+ .filter(attribute => attribute.type === type)
+ .map(attribute => attribute.name);
+ }
+ else {
+ names = await sql.getColumn(
+ `SELECT DISTINCT name
+ FROM attributes
+ WHERE isDeleted = 0
+ AND type = ?
+ AND name LIKE '%${utils.sanitizeSql(nameLike)}%'`, [type]);
}
names.sort();