mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Fix Windows wiki-link/graph showing duplicate and old-version notes (path separators)
This commit is contained in:
@@ -1325,7 +1325,10 @@
|
||||
function wikiLinkFolderPath(entry: NoteTitleEntry): string {
|
||||
const vaultRoot = $appConfig?.active_vault;
|
||||
if (!vaultRoot || !entry.path) return '';
|
||||
const rel = entry.path.startsWith(vaultRoot + '/') ? entry.path.slice(vaultRoot.length + 1) : entry.path;
|
||||
// Normalize Windows backslashes so the folder subtitle shows there too.
|
||||
const path = entry.path.replace(/\\/g, '/');
|
||||
const root = vaultRoot.replace(/\\/g, '/');
|
||||
const rel = path.startsWith(root + '/') ? path.slice(root.length + 1) : path;
|
||||
const parts = rel.split('/');
|
||||
// Return parent folder(s), excluding the filename
|
||||
return parts.length > 1 ? parts.slice(0, -1).join('/') + '/' : '';
|
||||
|
||||
@@ -76,8 +76,10 @@
|
||||
}
|
||||
|
||||
function getFolderKey(path: string): string {
|
||||
const vaultRoot = $appConfig?.active_vault || '';
|
||||
const rel = vaultRoot && path.startsWith(vaultRoot + '/') ? path.slice(vaultRoot.length + 1) : path;
|
||||
// Normalize Windows backslashes so folder grouping/colours work there too.
|
||||
const p = (path || '').replace(/\\/g, '/');
|
||||
const vaultRoot = ($appConfig?.active_vault || '').replace(/\\/g, '/');
|
||||
const rel = vaultRoot && p.startsWith(vaultRoot + '/') ? p.slice(vaultRoot.length + 1) : p;
|
||||
const slash = rel.indexOf('/');
|
||||
return slash >= 0 ? rel.slice(0, slash) : '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user