update active note
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { activeNote } from '@/composables/useNotes'
|
||||
import { setActiveNote } from '@/composables/useNotes'
|
||||
const props = defineProps<{
|
||||
references: Note[]
|
||||
}>()
|
||||
@@ -15,7 +15,7 @@ const props = defineProps<{
|
||||
</span>
|
||||
</li>
|
||||
<li v-for="reference in props.references">
|
||||
<a class="rounded-md" @click="activeNote = reference">
|
||||
<a class="rounded-md" @click="setActiveNote(reference.id)">
|
||||
<i class="far fa-file-alt fa-fw" />
|
||||
{{ reference.title }}
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user