mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
merged tree utils into tree service
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import linkService from '../services/link.js';
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import treeUtils from '../services/tree_utils.js';
|
||||
import treeService from '../services/tree.js';
|
||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function showDialog() {
|
||||
$linkTitle.val('');
|
||||
|
||||
async function setDefaultLinkTitle(noteId) {
|
||||
const noteTitle = await treeUtils.getNoteTitle(noteId);
|
||||
const noteTitle = await treeService.getNoteTitle(noteId);
|
||||
|
||||
$linkTitle.val(noteTitle);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ export async function showDialog() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const noteId = treeUtils.getNoteIdFromNotePath(suggestion.path);
|
||||
const noteId = treeService.getNoteIdFromNotePath(suggestion.path);
|
||||
|
||||
if (noteId) {
|
||||
setDefaultLinkTitle(noteId);
|
||||
@@ -43,7 +43,7 @@ export async function showDialog() {
|
||||
});
|
||||
|
||||
$autoComplete.on('autocomplete:cursorchanged', function(event, suggestion, dataset) {
|
||||
const noteId = treeUtils.getNoteIdFromNotePath(suggestion.path);
|
||||
const noteId = treeService.getNoteIdFromNotePath(suggestion.path);
|
||||
|
||||
setDefaultLinkTitle(noteId);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import noteDetailService from '../services/note_detail.js';
|
||||
import server from '../services/server.js';
|
||||
import toastService from "../services/toast.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import attributeAutocompleteService from "../services/attribute_autocomplete.js";
|
||||
import utils from "../services/utils.js";
|
||||
import linkService from "../services/link.js";
|
||||
@@ -66,7 +66,7 @@ function AttributesModel() {
|
||||
|
||||
for (const attr of ownedAttributes) {
|
||||
attr.labelValue = attr.type === 'label' ? attr.value : '';
|
||||
attr.relationValue = attr.type === 'relation' ? (await treeUtils.getNoteTitle(attr.value)) : '';
|
||||
attr.relationValue = attr.type === 'relation' ? (await treeService.getNoteTitle(attr.value)) : '';
|
||||
attr.selectedPath = attr.type === 'relation' ? attr.value : '';
|
||||
attr.labelDefinition = (attr.type === 'label-definition' && attr.value) ? attr.value : {
|
||||
labelType: "text",
|
||||
@@ -151,7 +151,7 @@ function AttributesModel() {
|
||||
attr.value = attr.labelValue;
|
||||
}
|
||||
else if (attr.type === 'relation') {
|
||||
attr.value = treeUtils.getNoteIdFromNotePath(attr.selectedPath);
|
||||
attr.value = treeService.getNoteIdFromNotePath(attr.selectedPath);
|
||||
}
|
||||
else if (attr.type === 'label-definition') {
|
||||
attr.value = attr.labelDefinition;
|
||||
|
||||
@@ -1,7 +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";
|
||||
import treeService from "../services/tree.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
@@ -34,7 +34,7 @@ export async function showDialog(node) {
|
||||
|
||||
$treePrefixInput.val(branch.prefix);
|
||||
|
||||
const noteTitle = await treeUtils.getNoteTitle(node.data.noteId);
|
||||
const noteTitle = await treeService.getNoteTitle(node.data.noteId);
|
||||
|
||||
$noteTitle.text(" - " + noteTitle);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||
import utils from "../services/utils.js";
|
||||
import cloningService from "../services/cloning.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import treeCache from "../services/tree_cache.js";
|
||||
|
||||
@@ -43,7 +43,7 @@ export async function showDialog(noteIds) {
|
||||
}
|
||||
|
||||
async function cloneNotesTo(notePath) {
|
||||
const targetNoteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||
const targetNoteId = treeService.getNoteIdFromNotePath(notePath);
|
||||
|
||||
for (const cloneNoteId of clonedNoteIds) {
|
||||
await cloningService.cloneNoteTo(cloneNoteId, targetNoteId, $clonePrefix.val());
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import utils from "../services/utils.js";
|
||||
import ws from "../services/ws.js";
|
||||
import toastService from "../services/toast.js";
|
||||
@@ -43,11 +43,11 @@ export async function showDialog(notePath, defaultType) {
|
||||
|
||||
$dialog.modal();
|
||||
|
||||
const {noteId, parentNoteId} = treeUtils.getNoteIdAndParentIdFromNotePath(notePath);
|
||||
const {noteId, parentNoteId} = treeService.getNoteIdAndParentIdFromNotePath(notePath);
|
||||
|
||||
branchId = await treeCache.getBranchId(parentNoteId, noteId);
|
||||
|
||||
const noteTitle = await treeUtils.getNoteTitle(noteId);
|
||||
const noteTitle = await treeService.getNoteTitle(noteId);
|
||||
|
||||
$noteTitle.html(noteTitle);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import utils from '../services/utils.js';
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import importService from "../services/import.js";
|
||||
|
||||
const $dialog = $("#import-dialog");
|
||||
@@ -30,7 +30,7 @@ export async function showDialog(noteId) {
|
||||
|
||||
parentNoteId = noteId;
|
||||
|
||||
$noteTitle.text(await treeUtils.getNoteTitle(parentNoteId));
|
||||
$noteTitle.text(await treeService.getNoteTitle(parentNoteId));
|
||||
|
||||
$dialog.modal();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import treeUtils from '../services/tree_utils.js';
|
||||
import treeService from '../services/tree.js';
|
||||
import noteAutocompleteService from '../services/note_autocomplete.js';
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
@@ -29,7 +29,7 @@ $form.on('submit', () => {
|
||||
$dialog.modal('hide');
|
||||
|
||||
if (callback) {
|
||||
callback(treeUtils.getNoteIdFromNotePath(notePath));
|
||||
callback(treeService.getNoteIdFromNotePath(notePath));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import noteAutocompleteService from "../services/note_autocomplete.js";
|
||||
import utils from "../services/utils.js";
|
||||
import cloningService from "../services/cloning.js";
|
||||
import treeUtils from "../services/tree_utils.js";
|
||||
import treeService from "../services/tree.js";
|
||||
import toastService from "../services/toast.js";
|
||||
import treeCache from "../services/tree_cache.js";
|
||||
import treeChangesService from "../services/branches.js";
|
||||
|
||||
Reference in New Issue
Block a user