mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	make note paths work better with hoisted note
This commit is contained in:
		
							parent
							
								
									6c188982b3
								
							
						
					
					
						commit
						34b8979016
					
				@ -1,6 +1,7 @@
 | 
				
			|||||||
import TabAwareWidget from "./tab_aware_widget.js";
 | 
					import TabAwareWidget from "./tab_aware_widget.js";
 | 
				
			||||||
import treeService from "../services/tree.js";
 | 
					import treeService from "../services/tree.js";
 | 
				
			||||||
import linkService from "../services/link.js";
 | 
					import linkService from "../services/link.js";
 | 
				
			||||||
 | 
					import hoistedNoteService from "../services/hoisted_note.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TPL = `
 | 
					const TPL = `
 | 
				
			||||||
<div class="note-paths-widget">
 | 
					<div class="note-paths-widget">
 | 
				
			||||||
@ -68,12 +69,18 @@ export default class NotePathsWidget extends TabAwareWidget {
 | 
				
			|||||||
        let parentNoteId = 'root';
 | 
					        let parentNoteId = 'root';
 | 
				
			||||||
        let curPath = '';
 | 
					        let curPath = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let passedHoistedNote = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (let i = 0; i < noteIdsPath.length; i++) {
 | 
					        for (let i = 0; i < noteIdsPath.length; i++) {
 | 
				
			||||||
            const noteId = noteIdsPath[i];
 | 
					            const noteId = noteIdsPath[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            curPath += (curPath ? '/' : '') + noteId;
 | 
					            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(
 | 
					                this.$currentPath.append(
 | 
				
			||||||
                    $("<a>")
 | 
					                    $("<a>")
 | 
				
			||||||
                        .attr('href', '#' + curPath)
 | 
					                        .attr('href', '#' + curPath)
 | 
				
			||||||
 | 
				
			|||||||
@ -790,7 +790,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    forceNoteSyncCommand({node}) {
 | 
					    forceNoteSyncCommand({node}) {
 | 
				
			||||||
        syncService.forceNoteSync(noteId);
 | 
					        syncService.forceNoteSync(node.data.noteId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    editNoteTitleCommand({node}) {
 | 
					    editNoteTitleCommand({node}) {
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,7 @@ const sql = require('./sql');
 | 
				
			|||||||
const cls = require('./cls');
 | 
					const cls = require('./cls');
 | 
				
			||||||
const utils = require('./utils');
 | 
					const utils = require('./utils');
 | 
				
			||||||
const optionService = require('./options');
 | 
					const optionService = require('./options');
 | 
				
			||||||
 | 
					const port = require('./port');
 | 
				
			||||||
const Option = require('../entities/option');
 | 
					const Option = require('../entities/option');
 | 
				
			||||||
const TaskContext = require('./task_context.js');
 | 
					const TaskContext = require('./task_context.js');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -55,7 +56,7 @@ async function isDbInitialized() {
 | 
				
			|||||||
async function initDbConnection() {
 | 
					async function initDbConnection() {
 | 
				
			||||||
    await cls.init(async () => {
 | 
					    await cls.init(async () => {
 | 
				
			||||||
        if (!await isDbInitialized()) {
 | 
					        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;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user