Skip to content

feat(structure): support search in DDL view - #7433

Merged
t8y2 merged 2 commits into
t8y2:mainfrom
0verme:feat/7294-table-structure-ddl-search
Aug 28, 2026
Merged

feat(structure): support search in DDL view#7433
t8y2 merged 2 commits into
t8y2:mainfrom
0verme:feat/7294-table-structure-ddl-search

Conversation

@0verme

@0verme 0verme commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix #7294: after opening the table structure editor's DDL tab (e.g. via Ctrl/Cmd+click on a table name), the DDL content could not be searched with Ctrl/Cmd+F.

Root Cause

The DDL tab was rendered as a plain <pre> element and had no search UX. The global keydown handler in TableStructureEditor intercepted Ctrl/Cmd+F (it only focused the column search in the columns tab), so neither the app search UI nor the browser find would appear for the DDL tab.

(Note: DdlViewDialog.vue is a separate path and already uses a read-only CodeMirror with EditorSearchPanel — it was not part of this issue.)

Changes

  • Render DDL with a lightweight read-only CodeMirror view instead of the plain <pre>.
  • Reuse the existing shared EditorSearchPanel and @codemirror/search (match navigation, count display, Enter, Esc, regex / case-sensitive toggles).
  • Keep the editor read-only via EditorState.readOnly.of(true).
  • Handle DDL refresh, tab switching, KeepAlive deactivate/unmount cleanup, and scroll position restoration.
  • Guard against duplicate shortcut handling with event.defaultPrevented.

Validation

  • New targeted Vitest suites: TableStructureEditor.ddlSearch.spec.ts + TableStructureEditor.ddlSearchSource.spec.ts (5 tests passed)
  • Structure-editor regression suites (primaryKey, charset/collation, concurrentTransition) passed
  • vue-tsc --noEmit passed
  • oxfmt --check passed
  • git diff --check passed

No Rust / backend / DDL-fetch logic was changed.

Reuse the existing read-only CodeMirror and EditorSearchPanel flow for the table structure DDL tab, including lifecycle-safe refresh and scroll handling.\n\nValidated with targeted Vitest suites, vue-tsc, and oxfmt.
@github-actions github-actions Bot added area/desktop Desktop application or Tauri shell enhancement New feature or request ui-change Changes user-visible interface, text, or visual assets labels Aug 27, 2026

@t8y2 t8y2 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

维护者补丁已推送(maintainerCanModify,fast-forward dca0bbda5cd936217):

  • 搜索面板不再遮挡「复制 DDL」按钮:给共享组件 EditorSearchPanel 增加可选的 open/close emits(对 QueryEditor/DdlViewDialog/NacosAdminConsole 等既有使用方是纯增量、零行为变化),TableStructureEditor 的 DDL tab 监听后在搜索面板打开期间隐藏同角的复制按钮。未用 CSS :has() 方案是考虑到 win7 旧 WebView 的兼容性。
  • loadEditorTheme 补传 themePalette(第 4 参,与 DdlViewDialog.vue:133 的调用形态一致),修复编辑器主题=跟随应用且非默认配色时 DDL tab 与其他编辑器主题不一致的问题。
  • 验证:vue-tsc 全量通过;聚焦测试 12/12 通过(ddlSearch×2、EditorSearchPanel×2、NacosAdminConsoleDelete)。

@t8y2
t8y2 merged commit 6d8e667 into t8y2:main Aug 28, 2026
14 checks passed
@t8y2

t8y2 commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Thanks for the contribution! Merged in 6d8e667, will be released in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/desktop Desktop application or Tauri shell enhancement New feature or request ui-change Changes user-visible interface, text, or visual assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 编辑表结构里的DDL优化

2 participants