Skip to content

Build your personal knowledge base with Trilium Notes

fix relation autocomplete

azivnerededc063df60
diff --git a/src/public/javascripts/dialogs/relations.js b/src/public/javascripts/dialogs/relations.js
index fd7ff82ebd..7b2aeeddb2 100644
--- a/src/public/javascripts/dialogs/relations.js
+++ b/src/public/javascripts/dialogs/relations.js
@@ -201,7 +201,7 @@ $dialog.on('focus', '.relation-name', function (e) {
$(this).autocomplete("search", $(this).val());
});
-async function initAutocomplete($el) {
+async function initNoteAutocomplete($el) {
if (!$el.hasClass("ui-autocomplete-input")) {
await $el.autocomplete({
source: async function (request, response) {
@@ -232,10 +232,14 @@ async function initAutocomplete($el) {
}
}
+$dialog.on('focus', '.relation-target-note-id', async function () {
+ await initNoteAutocomplete($(this));
+});
+
$dialog.on('click', '.relations-show-recent-notes', async function () {
const $autocomplete = $(this).parent().find('.relation-target-note-id');
- await initAutocomplete($autocomplete);
+ await initNoteAutocomplete($autocomplete);
$autocomplete.autocomplete("search", "");
});
diff --git a/src/services/relations.js b/src/services/relations.js
index 64f5542898..ce1e6e71b0 100644
--- a/src/services/relations.js
+++ b/src/services/relations.js
@@ -4,7 +4,7 @@ const repository = require('./repository');
const Relation = require('../entities/relation');
const BUILTIN_RELATIONS = [
- 'exampleBuiltIn'
+ 'runOnNoteView'
];
async function getNotesWithRelation(name, targetNoteId) {
diff --git a/src/views/index.ejs b/src/views/index.ejs
index b0e1d89282..19dd4b7ed3 100644
--- a/src/views/index.ejs
+++ b/src/views/index.ejs
@@ -629,7 +629,7 @@
</td>
<td>
<div class="input-group">
- <input id="jump-to-note-autocomplete" class="form-control relation-target-note-id"
+ <input class="form-control relation-target-note-id"
placeholder="search for note by its name"
data-bind="value: targetNoteId, valueUpdate: 'blur', event: { blur: $parent.relationChanged }"
style="width: 300px;">