mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 17:55:52 +01:00
refactored TabContext => NoteContext
This commit is contained in:
@@ -2,16 +2,16 @@ import appContext from "./app_context.js";
|
||||
import treeService from "./tree.js";
|
||||
|
||||
function getHoistedNoteId() {
|
||||
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
||||
const activeNoteContext = appContext.tabManager.getActiveNoteContext();
|
||||
|
||||
return activeTabContext ? activeTabContext.hoistedNoteId : 'root';
|
||||
return activeNoteContext ? activeNoteContext.hoistedNoteId : 'root';
|
||||
}
|
||||
|
||||
async function unhoist() {
|
||||
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
||||
const activeNoteContext = appContext.tabManager.getActiveNoteContext();
|
||||
|
||||
if (activeTabContext) {
|
||||
await activeTabContext.unhoist();
|
||||
if (activeNoteContext) {
|
||||
await activeNoteContext.unhoist();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@ function isHoistedNode(node) {
|
||||
|| node.data.noteId === getHoistedNoteId();
|
||||
}
|
||||
|
||||
async function checkNoteAccess(notePath, tabContext) {
|
||||
const resolvedNotePath = await treeService.resolveNotePath(notePath, tabContext.hoistedNoteId);
|
||||
async function checkNoteAccess(notePath, noteContext) {
|
||||
const resolvedNotePath = await treeService.resolveNotePath(notePath, noteContext.hoistedNoteId);
|
||||
|
||||
if (!resolvedNotePath) {
|
||||
console.log("Cannot activate " + notePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
const hoistedNoteId = tabContext.hoistedNoteId;
|
||||
const hoistedNoteId = noteContext.hoistedNoteId;
|
||||
|
||||
if (!resolvedNotePath.includes(hoistedNoteId)) {
|
||||
const confirmDialog = await import('../dialogs/confirm.js');
|
||||
|
||||
Reference in New Issue
Block a user