mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-11 01:03:51 +08:00
🐛 fix(query-editor): 移除搜索框顶部空白区域
- 禁用 Monaco 查找组件的顶部预留空间,保持浮层显示 - 删除 V2 查询编辑器中查找组件的额外 24px 顶部补偿 - 更新查找配置与样式回归测试
This commit is contained in:
@@ -4526,7 +4526,7 @@ describe('QueryEditor external SQL save', () => {
|
||||
expect(initialOptions).toMatchObject({
|
||||
fixedOverflowWidgets: true,
|
||||
find: {
|
||||
addExtraSpaceOnTop: true,
|
||||
addExtraSpaceOnTop: false,
|
||||
},
|
||||
hover: {
|
||||
enabled: true,
|
||||
@@ -11164,14 +11164,13 @@ describe('QueryEditor external SQL save', () => {
|
||||
expect(css).toContain('body[data-ui-version="v2"] .gn-v2-query-results .query-result-tab-text {');
|
||||
});
|
||||
|
||||
it('keeps Monaco find widget spacing scoped to the v2 query editor shell', () => {
|
||||
it('does not reserve vertical space for the Monaco find widget in the v2 query editor', () => {
|
||||
const source = readFileSync(new URL('./QueryEditor.tsx', import.meta.url), 'utf8');
|
||||
const css = readV2ThemeCss();
|
||||
|
||||
expect(source).toContain('addExtraSpaceOnTop: true');
|
||||
expect(css).toContain('body[data-ui-version="v2"] .gn-v2-query-monaco-stage:has(.monaco-editor .find-widget.visible:not(.hiddenEditor)) {');
|
||||
expect(css).toContain('padding-top: 24px;');
|
||||
expect(css).toContain('overflow: visible;');
|
||||
expect(source).not.toContain('addExtraSpaceOnTop: true');
|
||||
expect(css).not.toContain('body[data-ui-version="v2"] .gn-v2-query-monaco-stage:has(.monaco-editor .find-widget.visible:not(.hiddenEditor)) {');
|
||||
expect(css).not.toContain('padding-top: 24px;');
|
||||
expect(css).not.toContain('body[data-ui-version="v2"] .gn-v2-query-monaco-stage .monaco-editor .find-widget {');
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('QueryEditor i18n source guards', () => {
|
||||
expect(queryEditorSource).toContain('query_editor.action.find_in_editor');
|
||||
expect(queryEditorSource).toContain('gonavi:find-active-query');
|
||||
expect(queryEditorSource).toContain("editor.getAction?.('actions.find')");
|
||||
expect(queryEditorSource).toContain('addExtraSpaceOnTop: true');
|
||||
expect(queryEditorSource).toContain('addExtraSpaceOnTop: false');
|
||||
});
|
||||
|
||||
it('uses a localized wrapper for save query failures', () => {
|
||||
|
||||
@@ -210,9 +210,6 @@ export {
|
||||
const buildQueryEditorMonacoActionLabel = (key: string): string =>
|
||||
`GoNavi: ${translate(key)}`;
|
||||
|
||||
const QUERY_EDITOR_MONACO_FIND_OPTIONS = {
|
||||
addExtraSpaceOnTop: true,
|
||||
} as const;
|
||||
const QUERY_EDITOR_NATIVE_SELECT_CURRENT_LINE_EVENT = 'gonavi:native-select-current-line';
|
||||
const QUERY_EDITOR_MAC_FIND_WITH_SELECTION_COMBO = 'Meta+E';
|
||||
const QUERY_EDITOR_MAC_FIND_WITH_SELECTION_GUARD_ACTION_ID = 'gonavi.suppressMacFindWithSelection';
|
||||
@@ -316,7 +313,10 @@ const buildQueryEditorMonacoOptions = (isObjectEditQueryTab: boolean) => ({
|
||||
minimap: { enabled: false },
|
||||
automaticLayout: true,
|
||||
fixedOverflowWidgets: true,
|
||||
find: QUERY_EDITOR_MONACO_FIND_OPTIONS,
|
||||
// Keep the find widget as an overlay; Monaco's default top spacer creates a blank band.
|
||||
find: {
|
||||
addExtraSpaceOnTop: false,
|
||||
},
|
||||
hover: {
|
||||
enabled: true,
|
||||
delay: QUERY_EDITOR_HOVER_DELAY_MS,
|
||||
|
||||
@@ -296,11 +296,6 @@ body[data-ui-version="v2"] .gn-v2-query-monaco-stage {
|
||||
background: var(--gn-bg-panel);
|
||||
}
|
||||
|
||||
body[data-ui-version="v2"] .gn-v2-query-monaco-stage:has(.monaco-editor .find-widget.visible:not(.hiddenEditor)) {
|
||||
padding-top: 24px;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
body[data-ui-version="v2"] .gn-v2-query-monaco-shell {
|
||||
min-height: 0;
|
||||
overflow: visible;
|
||||
|
||||
Reference in New Issue
Block a user