File tree Expand file tree Collapse file tree
src/presentation/components/breadcrumbs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 :to =" `/note/${parent.id}`"
66 class =" breadcrumb"
77 >
8- {{ parent.content ?
9- typeof parent.content === 'string' ?
10- parent.content :
11- getTitle(parent.content) : '...' }}
8+ {{ parentTitle(parent.content) }}
129 <Icon
1310 v-if =" index < displayedParents.length - 1"
1411 name =" ChevronRight"
@@ -23,6 +20,7 @@ import { RouterLink } from 'vue-router';
2320import { computed } from ' vue' ;
2421import { Note } from ' @/domain/entities/Note.ts' ;
2522import { Icon } from ' @codexteam/ui/vue' ;
23+ import { OutputData } from ' @editorjs/editorjs' ;
2624
2725const props = defineProps <{
2826 noteParents: (Note | { id: string ; content: string })[];
@@ -43,6 +41,24 @@ const displayedParents = computed(() => {
4341
4442 return props .noteParents ;
4543});
44+
45+ /**
46+ * title of the parent
47+ *
48+ * @param content - parent's content, could be
49+ */
50+ const parentTitle = computed (() => {
51+ return (content : string | null | OutputData ) => {
52+ if (content === null ) {
53+ return ' ...' ;
54+ }
55+ if (typeof content === ' string' ) {
56+ return content ;
57+ }
58+
59+ return getTitle (content );
60+ };
61+ });
4662 </script >
4763
4864<style scoped>
You can’t perform that action at this time.
0 commit comments