mirror of
https://github.com/zadam/trilium.git
synced 2026-01-16 03:24:24 +01:00
chore(core): fix references to getHoistedNoteId
This commit is contained in:
parent
b9a59fe0c4
commit
321fcf34f2
@ -1,5 +1,5 @@
|
||||
import type { EntityChange } from "@triliumnext/commons";
|
||||
import { getContext } from "@triliumnext/core/src/services/context";
|
||||
import { getContext, getHoistedNoteId as getHoistedNoteIdInternal } from "@triliumnext/core/src/services/context";
|
||||
|
||||
type Callback = (...args: any[]) => any;
|
||||
|
||||
@ -18,7 +18,7 @@ function wrap(callback: Callback) {
|
||||
}
|
||||
|
||||
function getHoistedNoteId() {
|
||||
return getContext().get("hoistedNoteId") || "root";
|
||||
return getHoistedNoteIdInternal();
|
||||
}
|
||||
|
||||
function getComponentId() {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
import becca from "./becca.js";
|
||||
import { getLog } from "../services/log.js";
|
||||
import { getContext } from "src/services/context.js";
|
||||
import { getHoistedNoteId } from "src/services/context.js";
|
||||
|
||||
function isNotePathArchived(notePath: string[]) {
|
||||
const noteId = notePath[notePath.length - 1];
|
||||
@ -82,7 +82,7 @@ function getNoteTitleArrayForPath(notePathArray: string[]) {
|
||||
let hoistedNotePassed = false;
|
||||
|
||||
// this is a notePath from outside of hoisted subtree, so the full title path needs to be returned
|
||||
const hoistedNoteId = getContext().getHoistedNoteId();
|
||||
const hoistedNoteId = getHoistedNoteId();
|
||||
const outsideOfHoistedSubtree = !notePathArray.includes(hoistedNoteId);
|
||||
|
||||
for (const noteId of notePathArray) {
|
||||
|
||||
@ -9,7 +9,7 @@ import TaskContext from "../../services/task_context.js";
|
||||
import utils from "../../services/utils.js";
|
||||
import AbstractBeccaEntity from "./abstract_becca_entity.js";
|
||||
import BNote from "./bnote.js";
|
||||
import { getContext } from "src/services/context";
|
||||
import { getHoistedNoteId } from "src/services/context";
|
||||
|
||||
/**
|
||||
* Branch represents a relationship between a child note and its parent note. Trilium allows a note to have multiple
|
||||
@ -160,7 +160,7 @@ class BBranch extends AbstractBeccaEntity<BBranch> {
|
||||
}
|
||||
}
|
||||
|
||||
if ((this.noteId === "root" || this.noteId === getContext().getHoistedNoteId()) && !this.isWeak) {
|
||||
if ((this.noteId === "root" || this.noteId === getHoistedNoteId()) && !this.isWeak) {
|
||||
throw new Error("Can't delete root or hoisted branch/note");
|
||||
}
|
||||
|
||||
|
||||
@ -16,3 +16,7 @@ export function getContext(): ExecutionContext {
|
||||
if (!ctx) throw new Error("Context not initialized");
|
||||
return ctx;
|
||||
}
|
||||
|
||||
export function getHoistedNoteId() {
|
||||
return getContext().get("hoistedNoteId") || "root";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user