Skip to content

Commit 479ca63

Browse files
authored
Add setting to adjust textarea font size (#463)
1 parent 7468555 commit 479ca63

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

src/App.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
</template>
77

88
<script setup lang="ts">
9-
import { computed, markRaw, onMounted, onUnmounted, watch } from 'vue'
9+
import {
10+
computed,
11+
markRaw,
12+
onMounted,
13+
onUnmounted,
14+
watch,
15+
watchEffect
16+
} from 'vue'
1017
import BlockUI from 'primevue/blockui'
1118
import ProgressSpinner from 'primevue/progressspinner'
1219
import GraphCanvas from '@/components/graph/GraphCanvas.vue'
@@ -39,6 +46,14 @@ watch(
3946
{ immediate: true }
4047
)
4148
49+
watchEffect(() => {
50+
const fontSize = useSettingStore().get('Comfy.TextareaWidget.FontSize')
51+
document.documentElement.style.setProperty(
52+
'--comfy-textarea-font-size',
53+
`${fontSize}px`
54+
)
55+
})
56+
4257
const { t } = useI18n()
4358
const init = () => {
4459
useSettingStore().addSettings(app.ui.settings)

src/assets/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ body {
131131
resize: none;
132132
border: none;
133133
box-sizing: border-box;
134-
font-size: 10px;
134+
font-size: var(--comfy-textarea-font-size);
135135
}
136136

137137
.comfy-modal {

src/stores/settingStore.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,17 @@ export const useSettingStore = defineStore('setting', {
106106
options: ['normal', 'small'],
107107
defaultValue: window.innerWidth < 1600 ? 'small' : 'normal'
108108
})
109+
110+
app.ui.settings.addSetting({
111+
id: 'Comfy.TextareaWidget.FontSize',
112+
name: 'Textarea widget font size',
113+
type: 'slider',
114+
defaultValue: 10,
115+
attrs: {
116+
min: 8,
117+
max: 24
118+
}
119+
})
109120
},
110121

111122
set<K extends keyof Settings>(key: K, value: Settings[K]) {

src/types/apiTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ const zSettings = z.record(z.any()).and(
424424
'Comfy.Sidebar.Size': z.number(),
425425
'Comfy.SwitchUser': z.any(),
426426
'Comfy.SnapToGrid.GridSize': z.number(),
427+
'Comfy.TextareaWidget.FontSize': z.number(),
427428
'Comfy.UseNewMenu': z.any(),
428429
'Comfy.Validation.Workflows': z.boolean()
429430
})

0 commit comments

Comments
 (0)