From 4462dabc635321fa9a5787a90709b0eccfd7efaf Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 30 Jul 2024 10:12:47 -0400 Subject: [PATCH] Truncate JSON default value in node preview (#264) --- src/components/NodePreview.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/NodePreview.vue b/src/components/NodePreview.vue index 48b13bd03..43d21331f 100644 --- a/src/components/NodePreview.vue +++ b/src/components/NodePreview.vue @@ -40,7 +40,7 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830
{{ widgetInput.name }}
- {{ widgetInput.default }} + {{ truncateDefaultValue(widgetInput.default) }}
@@ -73,6 +73,12 @@ const slotInputDefs = allInputDefs.filter( const widgetInputDefs = allInputDefs.filter((input) => nodeDefStore.inputIsWidget(input) ) +const truncateDefaultValue = (value: any): string => { + if (value instanceof Object) { + return _.truncate(JSON.stringify(value), { length: 20 }) + } + return value +}