mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	create top level note and collapse tree now work relative to hoisted note, closes #343
This commit is contained in:
		@@ -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});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user