mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-23 23:35:57 +02:00
Create new notes in the open note's notebook when not in a notebook view
This commit is contained in:
@@ -375,7 +375,19 @@
|
|||||||
calYear = today.getFullYear();
|
calYear = today.getFullYear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const nbRelative = $viewMode === 'notebook' ? $activeNotebook?.relative_path ?? null : null;
|
// Target: active notebook, else the open note's folder, else root.
|
||||||
|
let nbRelative: string | null = null;
|
||||||
|
if ($viewMode === 'notebook' && $activeNotebook) {
|
||||||
|
nbRelative = $activeNotebook.relative_path || null;
|
||||||
|
} else if ($appConfig?.active_vault && $activeNotePath) {
|
||||||
|
const vaultN = $appConfig.active_vault.replace(/\\/g, '/');
|
||||||
|
const apN = $activeNotePath.replace(/\\/g, '/');
|
||||||
|
if (apN.startsWith(vaultN + '/')) {
|
||||||
|
const rel = apN.slice(vaultN.length + 1);
|
||||||
|
const slash = rel.lastIndexOf('/');
|
||||||
|
if (slash > 0) nbRelative = rel.slice(0, slash);
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const entry = await createNote(nbRelative, 'Untitled');
|
const entry = await createNote(nbRelative, 'Untitled');
|
||||||
noteCache.clear();
|
noteCache.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user