mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
split up autocomplete related functionality
This commit is contained in:
@@ -3,6 +3,7 @@ import cloningService from '../services/cloning.js';
|
||||
import linkService from '../services/link.js';
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import treeUtils from '../services/tree_utils.js';
|
||||
import autocompleteService from '../services/autocomplete.js';
|
||||
|
||||
const $dialog = $("#add-link-dialog");
|
||||
const $form = $("#add-link-form");
|
||||
@@ -46,13 +47,13 @@ async function showDialog() {
|
||||
$linkTitle.val('');
|
||||
|
||||
function setDefaultLinkTitle(noteId) {
|
||||
const noteTitle = treeService.getNoteTitle(noteId);
|
||||
const noteTitle = treeUtils.getNoteTitle(noteId);
|
||||
|
||||
$linkTitle.val(noteTitle);
|
||||
}
|
||||
|
||||
$autoComplete.autocomplete({
|
||||
source: await treeService.getAutocompleteItems(),
|
||||
source: await autocompleteService.getAutocompleteItems(),
|
||||
minLength: 0,
|
||||
change: () => {
|
||||
const val = $autoComplete.val();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import treeService from '../services/tree.js';
|
||||
import server from '../services/server.js';
|
||||
import treeCache from "../services/tree_cache.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
|
||||
const $dialog = $("#edit-tree-prefix-dialog");
|
||||
const $form = $("#edit-tree-prefix-form");
|
||||
@@ -24,7 +25,7 @@ async function showDialog() {
|
||||
|
||||
$treePrefixInput.val(branch.prefix).focus();
|
||||
|
||||
const noteTitle = treeService.getNoteTitle(currentNode.data.noteId);
|
||||
const noteTitle = treeUtils.getNoteTitle(currentNode.data.noteId);
|
||||
|
||||
$noteTitle.html(noteTitle);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import treeService from '../services/tree.js';
|
||||
import linkService from '../services/link.js';
|
||||
import utils from '../services/utils.js';
|
||||
import autocompleteService from '../services/autocomplete.js';
|
||||
|
||||
const $dialog = $("#jump-to-note-dialog");
|
||||
const $autoComplete = $("#jump-to-note-autocomplete");
|
||||
@@ -17,7 +18,7 @@ async function showDialog() {
|
||||
});
|
||||
|
||||
await $autoComplete.autocomplete({
|
||||
source: await utils.stopWatch("building autocomplete", treeService.getAutocompleteItems),
|
||||
source: await utils.stopWatch("building autocomplete", autocompleteService.getAutocompleteItems),
|
||||
minLength: 0
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import treeService from '../services/tree.js';
|
||||
import messagingService from '../services/messaging.js';
|
||||
import server from '../services/server.js';
|
||||
import utils from "../services/utils.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
|
||||
const $dialog = $("#recent-notes-dialog");
|
||||
const $searchInput = $('#recent-notes-search-input');
|
||||
@@ -46,7 +47,7 @@ async function showDialog() {
|
||||
let noteTitle;
|
||||
|
||||
try {
|
||||
noteTitle = await treeService.getNotePathTitle(notePath);
|
||||
noteTitle = await treeUtils.getNotePathTitle(notePath);
|
||||
}
|
||||
catch (e) {
|
||||
noteTitle = "[error - can't find note title]";
|
||||
|
||||
Reference in New Issue
Block a user