Feat: Add preview as plaintext toggle for Preview As Text (#7102)

## Summary

Adds a toggle to conditionally render the text as Markdown.

## Also...

Fixes some type issues across our myriad Widget types. We should
probably clean those up.

## Example


https://github.com/user-attachments/assets/24fed943-1e79-4ea4-a962-826b06d68761



This could be a good minimal testcase for dynamic widgets @AustinMroz

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7102-WIP-Feat-Add-preview-as-plaintext-toggle-for-Preview-As-Text-2bd6d73d3650810c8b25c84866c8875c)
by [Unito](https://www.unito.io)
This commit is contained in:
Alexander Brown
2025-12-02 14:37:57 -08:00
committed by GitHub
parent e887d69cdc
commit c263111eeb
8 changed files with 107 additions and 57 deletions

View File

@@ -10,7 +10,10 @@ import type {
INodeInputSlot,
INodeOutputSlot
} from '@/lib/litegraph/src/interfaces'
import type { IBaseWidget } from '@/lib/litegraph/src/types/widgets'
import type {
IBaseWidget,
IWidgetOptions
} from '@/lib/litegraph/src/types/widgets'
import { useLayoutMutations } from '@/renderer/core/layout/operations/layoutMutations'
import { LayoutSource } from '@/renderer/core/layout/types'
import type { NodeId } from '@/renderer/core/layout/types'
@@ -39,7 +42,7 @@ export interface SafeWidgetData {
type: string
value: WidgetValue
label?: string
options?: Record<string, unknown>
options?: IWidgetOptions<unknown>
callback?: ((value: unknown) => void) | undefined
spec?: InputSpec
slotMetadata?: WidgetSlotMetadata
@@ -107,7 +110,7 @@ export function safeWidgetMapper(
type: widget.type,
value: value,
label: widget.label,
options: widget.options ? { ...widget.options } : undefined,
options: widget.options,
callback: widget.callback,
spec,
slotMetadata: slotInfo,