update active note

This commit is contained in:
2023-05-13 07:29:27 +02:00
parent f96d139b55
commit 9b75843a9d
6 changed files with 19 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ import ListPlugin from '@ckeditor/ckeditor5-list/src/list'
import AutoformatPlugin from '@ckeditor/ckeditor5-autoformat/src/autoformat'
import ContextedPlugin from '@/ckeditor/ContextedPlugin'
import { mdToHtml } from '@/utils/markdown'
import { activeNote, getNoteByTitle } from '@/composables/useNotes'
import { getNoteByTitle, setActiveNote } from '@/composables/useNotes'
import Autocomplete from '@/components/Autocomplete.vue'
const props = defineProps<{ note: Note }>()
@@ -58,7 +58,7 @@ const editorElement = ref<HTMLInputElement | null>(null)
const handleClick = ({ data }: { data: any }) => {
const noteTitle = data.domTarget.textContent as string
const note = getNoteByTitle(noteTitle)
if (note) activeNote.value = note
if (note) setActiveNote(note.id)
}
const autocompleteRef = ref<InstanceType<typeof Autocomplete> | null>(null)