mirror of
https://github.com/modrinth/code.git
synced 2026-09-03 05:25:58 +00:00
mistake
This commit is contained in:
@@ -52,8 +52,8 @@ import {
|
|||||||
usePageLeaveSafety,
|
usePageLeaveSafety,
|
||||||
useSavable,
|
useSavable,
|
||||||
} from '@modrinth/ui'
|
} from '@modrinth/ui'
|
||||||
import { TeamMemberPermission } from '@modrinth/utils'
|
import { type MarkdownDocument, parseModrinthMarkdown, TeamMemberPermission } from '@modrinth/utils'
|
||||||
import { computed, useTemplateRef } from 'vue'
|
import { computed, ref, useTemplateRef, watch } from 'vue'
|
||||||
|
|
||||||
import AiImageWarningModal from '~/components/ui/AiImageWarningModal.vue'
|
import AiImageWarningModal from '~/components/ui/AiImageWarningModal.vue'
|
||||||
import { useImageUpload } from '~/composables/image-upload.ts'
|
import { useImageUpload } from '~/composables/image-upload.ts'
|
||||||
@@ -73,9 +73,18 @@ const { saved, current, saving, hasChanges, reset, save } = useSavable(
|
|||||||
|
|
||||||
const { confirmLeaveModal } = usePageLeaveSafety(hasChanges)
|
const { confirmLeaveModal } = usePageLeaveSafety(hasChanges)
|
||||||
|
|
||||||
|
const descriptionDocument = ref<MarkdownDocument | null>(null)
|
||||||
|
watch(
|
||||||
|
() => current.value.description,
|
||||||
|
async (text) => {
|
||||||
|
const trimmed = text?.trim() || ''
|
||||||
|
descriptionDocument.value = trimmed ? await parseModrinthMarkdown(trimmed) : null
|
||||||
|
},
|
||||||
|
{ immediate: true },
|
||||||
|
)
|
||||||
|
|
||||||
const descriptionWarning = computed(() => {
|
const descriptionWarning = computed(() => {
|
||||||
const text = current.value.description?.trim() || ''
|
const charCount = countText(descriptionDocument.value)
|
||||||
const charCount = countText(text)
|
|
||||||
|
|
||||||
if (charCount < MIN_DESCRIPTION_CHARS) {
|
if (charCount < MIN_DESCRIPTION_CHARS) {
|
||||||
return `It's recommended to have a description with at least ${MIN_DESCRIPTION_CHARS} readable characters. (${charCount}/${MIN_DESCRIPTION_CHARS})`
|
return `It's recommended to have a description with at least ${MIN_DESCRIPTION_CHARS} readable characters. (${charCount}/${MIN_DESCRIPTION_CHARS})`
|
||||||
|
|||||||
Reference in New Issue
Block a user