mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01: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
@ -498,9 +498,11 @@ async function loadTree() {
|
|||||||
return await treeBuilder.prepareTree(resp.notes, resp.branches, resp.relations);
|
return await treeBuilder.prepareTree(resp.notes, resp.branches, resp.relations);
|
||||||
}
|
}
|
||||||
|
|
||||||
function collapseTree(node = null) {
|
async function collapseTree(node = null) {
|
||||||
if (!node) {
|
if (!node) {
|
||||||
node = $tree.fancytree("getRootNode");
|
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
|
||||||
|
|
||||||
|
node = getNodesByNoteId(hoistedNoteId)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
node.setExpanded(false);
|
node.setExpanded(false);
|
||||||
@ -541,9 +543,11 @@ async function setNoteTitle(noteId, title) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createNewTopLevelNote() {
|
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) {
|
async function createNote(node, parentNoteId, target, isProtected, saveSelection = false) {
|
||||||
|
@ -8,7 +8,6 @@ const sql = require('./sql');
|
|||||||
const cls = require('./cls');
|
const cls = require('./cls');
|
||||||
const optionService = require('./options');
|
const optionService = require('./options');
|
||||||
const Option = require('../entities/option');
|
const Option = require('../entities/option');
|
||||||
const utils = require('../services/utils');
|
|
||||||
|
|
||||||
async function createConnection() {
|
async function createConnection() {
|
||||||
return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
|
return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user