-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: display the note parents structure #275
base: main
Are you sure you want to change the base?
Changes from 2 commits
73f4b36
6ba36ac
d9988fb
7baf8f1
931460d
441586d
04e849f
e78539c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,13 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt | |
*/ | ||
const parentNote = ref<Note | undefined>(undefined); | ||
|
||
/** | ||
* Note parents of the actual note | ||
* | ||
* Actual note by default | ||
*/ | ||
const noteParents = ref<Note[]>([]); | ||
|
||
/** | ||
* Load note by id | ||
* @param id - Note identifier got from composable argument | ||
|
@@ -172,6 +179,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt | |
canEdit.value = response.accessRights.canEdit; | ||
noteTools.value = response.tools; | ||
parentNote.value = response.parentNote; | ||
noteParents.value = response.parents; | ||
} | ||
|
||
/** | ||
|
@@ -265,6 +273,23 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt | |
parentNote.value = undefined; | ||
} | ||
|
||
/** | ||
* Format the received note parents into presentation format | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Description is not clear |
||
*/ | ||
function formatNoteParents(): string { | ||
if (currentId.value === null) { | ||
throw new Error('note id is not defined'); | ||
} | ||
let presentationFormat = ''; | ||
|
||
for (let value of noteParents.value) { | ||
presentationFormat += getTitle(value.content) + ' > '; | ||
} | ||
presentationFormat += noteTitle.value; | ||
|
||
return presentationFormat; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Also can't see the case with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can use anchor tag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's better to do it in a component |
||
} | ||
|
||
/** | ||
* Get note by custom hostname | ||
*/ | ||
|
@@ -315,6 +340,7 @@ export default function (options: UseNoteComposableOptions): UseNoteComposableSt | |
}); | ||
|
||
watch(noteTitle, (currentNoteTitle) => { | ||
formatNoteParents(); | ||
patchOpenedPageByUrl( | ||
route.path, | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,9 @@ export interface NoteDTO { | |
* Editor tools | ||
*/ | ||
tools: EditorTool[]; | ||
|
||
/** | ||
* Note parents | ||
*/ | ||
parents: Note[]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that making
noteParents
reactive is a bad thing to doWe can update them only by request to api
/GET note
so i can't see the case, when we update noteParents and imidiately change displayed content somewhereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still actual