notes search

This commit is contained in:
2023-04-29 14:56:48 +02:00
parent 1d6826e255
commit 4cc7c01365
8 changed files with 87 additions and 27 deletions

View File

@@ -25,13 +25,7 @@ watch(
)
export const setDefaultNotes = (defaultNotes: BaseNote[]) => {
baseNotes.value = defaultNotes.map(
(note): BaseNote => ({
...note,
created: new Date().getTime(),
modified: new Date().getTime(),
})
)
baseNotes.value = defaultNotes
}
export const getNoteById = (noteId: string) => {
@@ -41,7 +35,7 @@ export const getNoteById = (noteId: string) => {
export const findNotes = (query: string): Note[] => {
const removeMdFromText = (mdText: string): string => {
const div = document.createElement('div')
div.innerHTML = mdToHtml(mdText, 'c@')
div.innerHTML = mdToHtml(mdText, 'c@', getNoteById)
const textWithoutMd = div.textContent || div.innerText || ''
return textWithoutMd
}