Files
ComfyUI_frontend/src/renderer/extensions/vueNodes/widgets/components/WidgetMarkdown.vue
Simula_r 4b87b1fdc5 fix: remove LOD from vue nodes (#6950)
## Summary

Refactor to remove LOD from vue nodes. Also, hide Litegraph LOD settings
in vue nodes to prevent confusion / stale setting. Keep litegraph LOD
the exact same.

## Changes

- **What**: settings, all LOD related code in vue nodes

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6950-fix-remove-LOD-from-vue-nodes-2b76d73d365081568723f8cbc7be7e17)
by [Unito](https://www.unito.io)

---------

Co-authored-by: github-actions <github-actions@github.com>
2025-11-26 12:26:05 -07:00

71 lines
1.8 KiB
Vue

<template>
<div
class="widget-expands widget-markdown relative w-full"
@dblclick="startEditing"
>
<!-- Display mode: Rendered markdown -->
<div
class="comfy-markdown-content size-full min-h-[60px] overflow-y-auto rounded-lg text-sm"
:class="isEditing === false ? 'visible' : 'invisible'"
v-html="renderedHtml"
/>
<!-- Edit mode: Textarea -->
<Textarea
v-show="isEditing"
ref="textareaRef"
v-model="modelValue"
:aria-label="`${$t('g.edit')} ${widget.name || $t('g.markdown')} ${$t('g.content')}`"
class="absolute inset-0 min-h-[60px] w-full resize-none"
:pt="{
root: {
class: 'text-sm w-full h-full',
onBlur: handleBlur
}
}"
data-capture-wheel="true"
@click.stop
@keydown.stop
/>
</div>
</template>
<script setup lang="ts">
import Textarea from 'primevue/textarea'
import { computed, nextTick, ref } from 'vue'
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
import { renderMarkdownToHtml } from '@/utils/markdownRendererUtil'
const { widget } = defineProps<{
widget: SimplifiedWidget<string>
}>()
const modelValue = defineModel<string>({ default: '' })
// State
const isEditing = ref(false)
const textareaRef = ref<InstanceType<typeof Textarea> | undefined>()
// Computed
const renderedHtml = computed(() => {
return renderMarkdownToHtml(modelValue.value || '')
})
// Methods
const startEditing = async () => {
if (isEditing.value || widget.options?.read_only) return
isEditing.value = true
await nextTick()
// Focus the textarea
// @ts-expect-error - $el is an internal property of the Textarea component
textareaRef.value?.$el?.focus()
}
const handleBlur = () => {
isEditing.value = false
}
</script>