fix(explorer): allow setting displayName (closes #1824)
This commit is contained in:
1 parent
e3c50caf13
commit
bfa938cc62
2 files changed
+39
-1
No files matched your search
@@ -11,6 +11,7 @@ export class FileTrieNode<T extends FileTrieData = ContentDetails> {
|
||||
children: Array<FileTrieNode<T>>
|
||||
|
||||
private slugSegments: string[]
|
||||
private displayNameOverride?: string
|
||||
data: T | null
|
||||
|
||||
constructor(segments: string[], data?: T) {
|
||||
@@ -18,10 +19,15 @@ export class FileTrieNode<T extends FileTrieData = ContentDetails> {
|
||||
this.slugSegments = segments
|
||||
this.data = data ?? null
|
||||
this.isFolder = false
|
||||
this.displayNameOverride = undefined
|
||||
}
|
||||
|
||||
get displayName(): string {
|
||||
return this.data?.title ?? this.slugSegment ?? ""
|
||||
return this.displayNameOverride ?? this.data?.title ?? this.slugSegment ?? ""
|
||||
}
|
||||
|
||||
set displayName(name: string) {
|
||||
this.displayNameOverride = name
|
||||
}
|
||||
|
||||
get slug(): FullSlug {
|
||||
|
||||
Reference in new issue
Block a user