diff --git a/front/src/components/common/ContentForm.vue b/front/src/components/common/ContentForm.vue index 3e4de5af8..70c0c67da 100644 --- a/front/src/components/common/ContentForm.vue +++ b/front/src/components/common/ContentForm.vue @@ -7,7 +7,6 @@ import { useI18n } from 'vue-i18n' import useLogger from '~/composables/useLogger' import Textarea from '~/components/ui/Textarea.vue' -import Button from '~/components/ui/Button.vue' interface Events { (e: 'update:modelValue', value: string): void @@ -48,86 +47,16 @@ const labels = computed(() => ({ const remainingChars = computed(() => props.charLimit - props.modelValue.length) -const loadPreview = async () => { - isLoadingPreview.value = true - try { - const response = await axios.post('text-preview/', { text: value.value, permissive: props.permissive }) - preview.value = response.data.rendered - } catch (error) { - logger.error(error) - } - isLoadingPreview.value = false -} - -watchDebounced(value, async () => { - await loadPreview() -}, { immediate: true, debounce: 500 }) - -watchEffect(async () => { - if (isPreviewing.value) { - if (value.value && !preview.value && !isLoadingPreview.value) { - await loadPreview() - } - } -}) - -watch(isPreviewing, (to, from) => { - if (from === true) { - textarea.value.focus() - } -}, { flush: 'post' }) - -onMounted(async () => { - if (props.autofocus) { - await nextTick() - textarea.value.focus() - } -})