contexted link highlight + adjust prettier

This commit is contained in:
2023-04-30 16:57:50 +02:00
parent 2ff849219b
commit 8db4583b0b
11 changed files with 53 additions and 74 deletions

View File

@@ -15,8 +15,7 @@ export const notes = computed<Note[]>(() => {
.sort((a, b) => b.modified - a.modified) as Note[]
})
watch(notes, () => {
if (notes.value.length > 0 && !activeNote.value)
activeNote.value = rootNote.value
if (notes.value.length > 0 && !activeNote.value) activeNote.value = rootNote.value
})
export const activeNote = ref<Note>()
@@ -66,11 +65,7 @@ export const updateNote = (noteId: string, note: Note) => {
baseNotes[noteId] = updatedNote
}
export const addNote = (
title: string,
content: string,
goToNote: boolean = false
) => {
export const addNote = (title: string, content: string, goToNote: boolean = false) => {
const id = shortid.generate()
const newNote: BaseNote = {
id,
@@ -80,8 +75,7 @@ export const addNote = (
modified: new Date().getTime(),
}
baseNotes[id] = newNote
if (goToNote)
activeNote.value = notes.value.find((note) => note.id === newNote.id)
if (goToNote) activeNote.value = notes.value.find((note) => note.id === newNote.id)
}
const getNoteLinksByNoteId = (noteId: string): string[] => {