fix relation autocomplete

This commit is contained in:
azivner 2018-07-29 12:34:40 +02:00
parent 986eace1be
commit ededc063df
3 changed files with 8 additions and 4 deletions

View File

@ -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", "");
});

View File

@ -4,7 +4,7 @@ const repository = require('./repository');
const Relation = require('../entities/relation');
const BUILTIN_RELATIONS = [
'exampleBuiltIn'
'runOnNoteView'
];
async function getNotesWithRelation(name, targetNoteId) {

View File

@ -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;">