generated from antfu/vitesse-nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support markdown for the feedback body
- Loading branch information
1 parent
3be5f57
commit 2d84d1b
Showing
9 changed files
with
622 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<script setup lang="ts"> | ||
import type { HTMLAttributes } from 'vue' | ||
import { useVModel } from '@vueuse/core' | ||
import { EditorContent, useEditor } from '@tiptap/vue-3' | ||
import StarterKit from '@tiptap/starter-kit' | ||
import { cn } from '~/utils' | ||
const props = defineProps<{ | ||
class?: HTMLAttributes['class'] | ||
defaultValue?: string | ||
modelValue?: string | ||
placeholder: string | ||
}>() | ||
const emits = defineEmits<{ | ||
(e: 'update:modelValue', payload: string | number): void | ||
}>() | ||
const modelValue = useVModel(props, 'modelValue', emits, { | ||
passive: true, | ||
defaultValue: props.defaultValue, | ||
}) | ||
const editor = useEditor({ | ||
content: modelValue.value, | ||
editorProps: { | ||
attributes: { | ||
'class': 'focus:outline-none', | ||
'data-placeholder': props.placeholder, | ||
}, | ||
}, | ||
extensions: [ | ||
StarterKit, | ||
], | ||
onUpdate({ editor }) { | ||
modelValue.value = editor.getHTML() | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<EditorContent | ||
:class="cn('prose prose-sm min-h-40 rounded-md border border-input bg-background px-3 py-2 ring-offset-background focus-within:outline-none focus-within:ring-1 focus-within:ring-ring disabled:cursor-not-allowed disabled:opacity-50', props.class)" | ||
:editor="editor" | ||
/> | ||
</template> | ||
|
||
<style scoped> | ||
:deep(.ProseMirror:has(> p:only-child > br:only-child):before) { | ||
@apply text-slate-400 float-left pointer-events-none h-0; | ||
content: attr(data-placeholder); | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as Textarea } from './Textarea.vue' | ||
export { default as MarkdownTextarea } from './MarkdownTextarea.vue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.