This commit is contained in:
2023-05-31 20:14:46 +02:00
parent 9cd6382bfc
commit de12d22434
7 changed files with 31 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import ContextedPlugin from '@/ckeditor/ContextedPlugin'
import { mdToHtml, htmlToMd } from '@/utils/markdown'
import { getNoteByTitle, setActiveNote, addNote } from '@/composables/useNotes'
import Autocomplete from '@/components/Note/Autocomplete.vue'
import { Haptics, ImpactStyle } from '@capacitor/haptics'
const props = defineProps<{ note: Note }>()
@@ -61,12 +62,13 @@ const editorElement = ref<HTMLInputElement | null>(null)
watch(editorData, () => emit('update', htmlToMd(editorData.value)))
let editorInstance: any
const handleClick = ({ data }: { data: any }) => {
const handleClick = async ({ data }: { data: any }) => {
if (!data.domTarget.hasAttribute('data-contexted-link')) return
const noteTitle = data.domTarget.textContent as string
let note: BaseNote | Note | undefined = getNoteByTitle(noteTitle)
if (!note) note = addNote(noteTitle, '')
setActiveNote(note.id)
await Haptics.impact({ style: ImpactStyle.Light })
}
const autocompleteRef = ref<InstanceType<typeof Autocomplete> | null>(null)

View File

@@ -2,6 +2,7 @@
import { Capacitor } from '@capacitor/core'
import { Dialog } from '@capacitor/dialog'
import type { ConfirmOptions } from '@capacitor/dialog'
import { Haptics, ImpactStyle } from '@capacitor/haptics'
const props = defineProps<{
note: Note
@@ -43,6 +44,7 @@ const emit = defineEmits<{
const openModal = async (open: () => void, modal: ModalOptions) => {
if (['android', 'ios'].includes(Capacitor.getPlatform())) {
const { value: confirmed } = await Dialog.confirm(modal.confirmOptions)
await Haptics.impact({ style: ImpactStyle.Light });
if (confirmed) emit('execute', modal.key)
} else {
open()