mirror of
https://github.com/zadam/trilium.git
synced 2025-01-17 20:48:12 +08:00
create top level note and collapse tree now work relative to hoisted note, closes #343
This commit is contained in:
parent
aa58788769
commit
cce8c1b674
2 changed files with 8 additions and 5 deletions
|
@ -498,9 +498,11 @@ async function loadTree() {
|
|||
return await treeBuilder.prepareTree(resp.notes, resp.branches, resp.relations);
|
||||
}
|
||||
|
||||
function collapseTree(node = null) {
|
||||
async function collapseTree(node = null) {
|
||||
if (!node) {
|
||||
node = $tree.fancytree("getRootNode");
|
||||
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
|
||||
|
||||
node = getNodesByNoteId(hoistedNoteId)[0];
|
||||
}
|
||||
|
||||
node.setExpanded(false);
|
||||
|
@ -541,9 +543,11 @@ async function setNoteTitle(noteId, title) {
|
|||
}
|
||||
|
||||
async function createNewTopLevelNote() {
|
||||
const rootNode = getNodesByNoteId('root')[0];
|
||||
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
|
||||
|
||||
await createNote(rootNode, "root", "into", false);
|
||||
const rootNode = getNodesByNoteId(hoistedNoteId)[0];
|
||||
|
||||
await createNote(rootNode, hoistedNoteId, "into", false);
|
||||
}
|
||||
|
||||
async function createNote(node, parentNoteId, target, isProtected, saveSelection = false) {
|
||||
|
|
|
@ -8,7 +8,6 @@ const sql = require('./sql');
|
|||
const cls = require('./cls');
|
||||
const optionService = require('./options');
|
||||
const Option = require('../entities/option');
|
||||
const utils = require('../services/utils');
|
||||
|
||||
async function createConnection() {
|
||||
return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
|
||||
|
|
Loading…
Reference in a new issue