Skip to content

Commit 4462dab

Browse files
authored
Truncate JSON default value in node preview (#264)
1 parent 53bfc0c commit 4462dab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/NodePreview.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ https://github.com/Nuked88/ComfyUI-N-Sidebar/blob/7ae7da4a9761009fb6629bc04c6830
4040
<div class="_sb_col">{{ widgetInput.name }}</div>
4141
<div class="_sb_col middle-column"></div>
4242
<div class="_sb_col _sb_inherit">
43-
{{ widgetInput.default }}
43+
{{ truncateDefaultValue(widgetInput.default) }}
4444
</div>
4545
<div class="_sb_col _sb_arrow">&#x25B6;</div>
4646
</div>
@@ -73,6 +73,12 @@ const slotInputDefs = allInputDefs.filter(
7373
const widgetInputDefs = allInputDefs.filter((input) =>
7474
nodeDefStore.inputIsWidget(input)
7575
)
76+
const truncateDefaultValue = (value: any): string => {
77+
if (value instanceof Object) {
78+
return _.truncate(JSON.stringify(value), { length: 20 })
79+
}
80+
return value
81+
}
7682
</script>
7783

7884
<style scoped>

0 commit comments

Comments
 (0)