🐛 fix(table-designer): 去除 SQL 变更重复标记

- 移除 Monaco glyph margin 变更标记通道

- 仅保留 line decorations 左侧单一变更标记

- 补充防重复标记回归测试

Refs #324
This commit is contained in:
Syngnat
2026-04-26 18:04:01 +08:00
parent 09ecc841ab
commit 01dd62f4e2
2 changed files with 12 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ describe('TableDesignerSqlPreview', () => {
expect(markup).toContain('data-theme="gonavi-sql-preview-light"');
expect(markup).toContain('"readOnly":true');
expect(markup).toContain('"lineNumbers":"on"');
expect(markup).not.toContain('"glyphMargin":true');
expect(markup).toContain('ALTER TABLE');
expect(markup).toContain('RENAME COLUMN');
@@ -143,6 +144,7 @@ describe('TableDesignerSqlPreview', () => {
options: expect.objectContaining({
className: expect.stringContaining('gonavi-sql-preview-change-line-add'),
isWholeLine: true,
linesDecorationsClassName: expect.stringContaining('gonavi-sql-preview-change-marker-add'),
}),
}),
expect.objectContaining({
@@ -150,12 +152,22 @@ describe('TableDesignerSqlPreview', () => {
options: expect.objectContaining({
className: expect.stringContaining('gonavi-sql-preview-change-line-drop'),
isWholeLine: true,
linesDecorationsClassName: expect.stringContaining('gonavi-sql-preview-change-marker-drop'),
}),
}),
]),
);
const firstDecorationCall = mockEditor.deltaDecorations.mock.calls[0] as unknown as [unknown, unknown[]];
expect(firstDecorationCall[1]).toHaveLength(2);
expect(firstDecorationCall[1]).toEqual(
expect.arrayContaining([
expect.objectContaining({
options: expect.not.objectContaining({
glyphMarginClassName: expect.any(String),
}),
}),
]),
);
});
it('uses the dark SQL preview theme when dark mode is enabled', () => {

View File

@@ -151,7 +151,6 @@ const TableDesignerSqlPreview: React.FC<TableDesignerSqlPreviewProps> = ({
range: new monaco.Range(highlight.lineNumber, 1, highlight.lineNumber, endColumn),
options: {
className: getLineDecorationClassName(highlight.kind),
glyphMarginClassName: getLineDecorationMarkerClassName(highlight.kind),
hoverMessage: { value: highlight.label },
isWholeLine: true,
linesDecorationsClassName: getLineDecorationMarkerClassName(highlight.kind),
@@ -233,7 +232,6 @@ const TableDesignerSqlPreview: React.FC<TableDesignerSqlPreviewProps> = ({
automaticLayout: true,
fontFamily: '"JetBrains Mono", "Cascadia Code", Consolas, monospace',
fontSize: 13,
glyphMargin: true,
lineNumbers: 'on',
lineDecorationsWidth: 14,
minimap: { enabled: false },