make note paths work better with hoisted note

This commit is contained in:
zadam 2020-04-08 20:38:50 +02:00
parent 6c188982b3
commit 34b8979016
3 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,7 @@
import TabAwareWidget from "./tab_aware_widget.js";
import treeService from "../services/tree.js";
import linkService from "../services/link.js";
import hoistedNoteService from "../services/hoisted_note.js";
const TPL = `
<div class="note-paths-widget">
@ -68,12 +69,18 @@ export default class NotePathsWidget extends TabAwareWidget {
let parentNoteId = 'root';
let curPath = '';
let passedHoistedNote = false;
for (let i = 0; i < noteIdsPath.length; i++) {
const noteId = noteIdsPath[i];
curPath += (curPath ? '/' : '') + noteId;
if (noteId !== 'root' || noteIdsPath.length < 3) {
if (noteId === hoistedNoteService.getHoistedNoteId()) {
passedHoistedNote = true;
}
if (passedHoistedNote && (noteId !== hoistedNoteService.getHoistedNoteId() || noteIdsPath.length - i < 3)) {
this.$currentPath.append(
$("<a>")
.attr('href', '#' + curPath)

View file

@ -790,7 +790,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
}
forceNoteSyncCommand({node}) {
syncService.forceNoteSync(noteId);
syncService.forceNoteSync(node.data.noteId);
}
editNoteTitleCommand({node}) {

View file

@ -8,6 +8,7 @@ const sql = require('./sql');
const cls = require('./cls');
const utils = require('./utils');
const optionService = require('./options');
const port = require('./port');
const Option = require('../entities/option');
const TaskContext = require('./task_context.js');
@ -55,7 +56,7 @@ async function isDbInitialized() {
async function initDbConnection() {
await cls.init(async () => {
if (!await isDbInitialized()) {
log.info("DB not initialized, please visit setup page to see instructions on how to initialize Trilium.");
log.info(`DB not initialized, please visit setup page` + (utils.isElectron() ? '' : ` - http://[your-server-host]:${await port} to see instructions on how to initialize Trilium.`));
return;
}