feat(settings): 拆分 SQL 编辑器与查询结果字号

- 新增 SQL 编辑器独立字号与跟随全局配置
- 将查询编辑器和 DDL 预览接入 SQL 专用排版
- 迁移旧版耦合字号设置并保留原有视觉大小
- 更新六语种文案并补充持久化与组件测试
This commit is contained in:
Syngnat
2026-07-23 11:24:44 +08:00
parent 175c7a908c
commit 5a5fbf04fe
17 changed files with 373 additions and 43 deletions

View File

@@ -0,0 +1,42 @@
import { describe, expect, it } from 'vitest';
import {
migrateLegacySqlEditorTypographySettings,
resolveSqlEditorFontSize,
sanitizeSqlEditorTypographySettings,
} from './sqlEditorTypography';
describe('SQL editor typography', () => {
it('derives a code-sized value while following the global font size', () => {
expect(resolveSqlEditorFontSize({
globalFontSize: 14,
sqlEditorFontSize: 20,
sqlEditorFontSizeFollowGlobal: true,
})).toBe(13);
});
it('uses and clamps an independent SQL editor font size', () => {
expect(resolveSqlEditorFontSize({
globalFontSize: 14,
sqlEditorFontSize: 99,
sqlEditorFontSizeFollowGlobal: false,
})).toBe(20);
expect(sanitizeSqlEditorTypographySettings({
sqlEditorFontSize: 9,
sqlEditorFontSizeFollowGlobal: false,
})).toEqual({
sqlEditorFontSize: 10,
sqlEditorFontSizeFollowGlobal: false,
});
});
it('preserves the legacy editor size derived from a custom data-table font', () => {
expect(migrateLegacySqlEditorTypographySettings({
dataTableFontSize: 18,
dataTableFontSizeFollowGlobal: false,
})).toEqual({
sqlEditorFontSize: 17,
sqlEditorFontSizeFollowGlobal: false,
});
});
});