Add setting to adjust textarea font size (#463)

This commit is contained in:
Chenlei Hu
2024-08-16 10:17:40 -04:00
committed by GitHub
parent 7468555c06
commit 479ca63e3c
4 changed files with 29 additions and 2 deletions

View File

@@ -6,7 +6,14 @@
</template>
<script setup lang="ts">
import { computed, markRaw, onMounted, onUnmounted, watch } from 'vue'
import {
computed,
markRaw,
onMounted,
onUnmounted,
watch,
watchEffect
} from 'vue'
import BlockUI from 'primevue/blockui'
import ProgressSpinner from 'primevue/progressspinner'
import GraphCanvas from '@/components/graph/GraphCanvas.vue'
@@ -39,6 +46,14 @@ watch(
{ immediate: true }
)
watchEffect(() => {
const fontSize = useSettingStore().get('Comfy.TextareaWidget.FontSize')
document.documentElement.style.setProperty(
'--comfy-textarea-font-size',
`${fontSize}px`
)
})
const { t } = useI18n()
const init = () => {
useSettingStore().addSettings(app.ui.settings)

View File

@@ -131,7 +131,7 @@ body {
resize: none;
border: none;
box-sizing: border-box;
font-size: 10px;
font-size: var(--comfy-textarea-font-size);
}
.comfy-modal {

View File

@@ -106,6 +106,17 @@ export const useSettingStore = defineStore('setting', {
options: ['normal', 'small'],
defaultValue: window.innerWidth < 1600 ? 'small' : 'normal'
})
app.ui.settings.addSetting({
id: 'Comfy.TextareaWidget.FontSize',
name: 'Textarea widget font size',
type: 'slider',
defaultValue: 10,
attrs: {
min: 8,
max: 24
}
})
},
set<K extends keyof Settings>(key: K, value: Settings[K]) {

View File

@@ -424,6 +424,7 @@ const zSettings = z.record(z.any()).and(
'Comfy.Sidebar.Size': z.number(),
'Comfy.SwitchUser': z.any(),
'Comfy.SnapToGrid.GridSize': z.number(),
'Comfy.TextareaWidget.FontSize': z.number(),
'Comfy.UseNewMenu': z.any(),
'Comfy.Validation.Workflows': z.boolean()
})