From 3e8c78231578338b4a7e1a2dd4ca0646ff0276b1 Mon Sep 17 00:00:00 2001 From: keven Date: Fri, 17 Oct 2025 23:57:51 +0800 Subject: [PATCH] refactor(front): update MarkdownInputField import path and enhance TextUploadInputTextView component structure for improved readability --- front/components/Field/MarkdownInputField.vue | 4 +- .../Home/Text/TextUploadInputTextView.vue | 128 +++++++++--------- .../{Tiptap.vue => Tiptap/Index.vue} | 19 ++- 3 files changed, 79 insertions(+), 72 deletions(-) rename front/components/{Tiptap.vue => Tiptap/Index.vue} (65%) diff --git a/front/components/Field/MarkdownInputField.vue b/front/components/Field/MarkdownInputField.vue index 6fd52c3..8bb6621 100644 --- a/front/components/Field/MarkdownInputField.vue +++ b/front/components/Field/MarkdownInputField.vue @@ -3,11 +3,11 @@ diff --git a/front/components/Home/Text/TextUploadInputTextView.vue b/front/components/Home/Text/TextUploadInputTextView.vue index 7dc0f0a..8bf3d5d 100644 --- a/front/components/Home/Text/TextUploadInputTextView.vue +++ b/front/components/Home/Text/TextUploadInputTextView.vue @@ -1,74 +1,72 @@ diff --git a/front/components/Tiptap.vue b/front/components/Tiptap/Index.vue similarity index 65% rename from front/components/Tiptap.vue rename to front/components/Tiptap/Index.vue index 56442f5..5e01987 100644 --- a/front/components/Tiptap.vue +++ b/front/components/Tiptap/Index.vue @@ -3,9 +3,12 @@ import { Editor, EditorContent } from '@tiptap/vue-3' import StarterKit from '@tiptap/starter-kit' import { Markdown } from 'tiptap-markdown' import Placeholder from '@tiptap/extension-placeholder' +import { cx } from 'class-variance-authority' + const props = defineProps<{ modelValue?: string placeholder?: string + class?: string }>() const emit = defineEmits<{ (e: 'update:modelValue', value: string): void @@ -27,14 +30,14 @@ onMounted(() => { // CommandsPlugin, ], onUpdate: () => { - emit('update:modelValue', editor.value?.storage?.markdown?.getMarkdown() ?? '') + emit('update:modelValue', (editor.value as any)?.storage?.markdown?.getMarkdown() ?? '') }, }) }) watch( () => props.modelValue, (value) => { - if (value !== editor.value?.storage?.markdown?.getMarkdown()) { + if (value !== (editor.value as any)?.storage?.markdown?.getMarkdown()) { editor.value?.commands.setContent(value ?? '') } } @@ -45,7 +48,13 @@ onUnmounted(() => {