mirror of
https://github.com/keven1024/015.git
synced 2026-06-07 21:04:33 +00:00
refactor(front): replace MarkdownInputField with RichInputField for improved JSON handling in text uploads, update Tiptap component to support JSONContent, and increment dependency versions for better compatibility
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
<template>
|
||||
<Tiptap v-model="value" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Tiptap from '@/components/Tiptap.vue'
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
rules?: RuleExpression<string>
|
||||
}>()
|
||||
const { value, } = useField<string>(props.name, props.rules)
|
||||
</script>
|
||||
20
front/components/Field/RichInputField.vue
Normal file
20
front/components/Field/RichInputField.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<Tiptap :model-value="jsonValue" @update:model-value="(v) => setValue(JSON.stringify(v))" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import Tiptap from '@/components/Tiptap.vue'
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
rules?: RuleExpression<string>
|
||||
}>()
|
||||
const { value, setValue } = useField<string>(props.name, props.rules)
|
||||
const jsonValue = computed(() => {
|
||||
try {
|
||||
return value.value ? JSON.parse(value.value) : {}
|
||||
} catch (error) {
|
||||
return {}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user