Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: editor shortcut issue (#20641)
ecmadaobc69ffd449d6
diff --git a/frontend/src/react/components/monaco/core.test.ts b/frontend/src/react/components/monaco/core.test.tsindex 00ae8d9efe..44acf383be 100644--- a/frontend/src/react/components/monaco/core.test.ts+++ b/frontend/src/react/components/monaco/core.test.ts@@ -17,9 +17,14 @@ const mocks = vi.hoisted(() => {getModifiedEditor: vi.fn(() => modifiedEditor),};const monaco = {+ // `loadMonacoEditor` unbinds Cmd/Ctrl+L on load; the mock must expose the+ // keybinding API it touches or every editor-creating test throws on load.+ KeyMod: { CtrlCmd: 2048 },+ KeyCode: { KeyL: 42 },editor: {create: vi.fn(() => editor),createDiffEditor: vi.fn(() => diffEditor),+ addKeybindingRule: vi.fn(),},};return {diff --git a/frontend/src/react/components/monaco/core.ts b/frontend/src/react/components/monaco/core.tsindex 0ee2cae2d1..7a23742787 100644--- a/frontend/src/react/components/monaco/core.ts+++ b/frontend/src/react/components/monaco/core.ts@@ -60,6 +60,14 @@ export const loadMonacoEditor = async (): Promise<typeof MonacoType> => {}monacoModule = await import("monaco-editor");+ // Monaco binds Cmd/Ctrl+L to `expandLineSelection` and preventDefault()s it,+ // stealing the browser's address-bar shortcut while the editor is focused.+ // Unbind the chord (the "-" prefix removes the binding) so the keypress falls+ // through to the browser; the command stays reachable via the command palette.+ monacoModule.editor.addKeybindingRule({+ keybinding: monacoModule.KeyMod.CtrlCmd | monacoModule.KeyCode.KeyL,+ command: "-expandLineSelection",+ });monacoLoadDefer.resolve(monacoModule);return monacoModule;};diff --git a/frontend/src/react/pages/settings/general/SQLEditorSection.test.tsx b/frontend/src/react/pages/settings/general/SQLEditorSection.test.tsxindex 589bf7b0c7..eae85de481 100644--- a/frontend/src/react/pages/settings/general/SQLEditorSection.test.tsx+++ b/frontend/src/react/pages/settings/general/SQLEditorSection.test.tsx@@ -270,6 +270,19 @@ describe("SQLEditorSection theme", () => {expect(ref.current?.isDirty()).toBe(false);});+ test("defaults to Default Light when the workspace has no theme config", () => {+ // beforeEach leaves sqlEditorThemeId = "" (a brand-new workspace).+ const ref = createRef<SectionHandle>();+ render(+ <SQLEditorSection ref={ref} title="SQL Editor" onDirtyChange={() => {}} />+ );++ const lightSegment = querySegment("Default Light");+ expect(lightSegment?.querySelector('[data-state="checked"]')).toBeTruthy();+ // The default selection must not register as a pending change.+ expect(ref.current?.isDirty()).toBe(false);+ });+test("without setWorkspaceProfile permission the theme control is disabled", () => {mocks.hasWorkspacePermissionV2.mockImplementation((p: string) => p !== "bb.settings.setWorkspaceProfile"diff --git a/frontend/src/react/pages/settings/general/SQLEditorSection.tsx b/frontend/src/react/pages/settings/general/SQLEditorSection.tsxindex b2cab5ed2e..065f3003ef 100644--- a/frontend/src/react/pages/settings/general/SQLEditorSection.tsx+++ b/frontend/src/react/pages/settings/general/SQLEditorSection.tsx@@ -24,6 +24,7 @@ import {themeToAnchors,} from "@/react/components/sql-editor/theme/derive";import {+ DEFAULT_THEME_ID,PRESET_BY_ID,PRESETS,} from "@/react/components/sql-editor/theme/presets";@@ -163,7 +164,10 @@ export const SQLEditorSection = forwardRef<} => {const custom = workspaceProfile.sqlEditorCustomTheme;return {- selectedThemeId: workspaceProfile.sqlEditorThemeId || "",+ // A brand-new workspace has no `sqlEditorThemeId`; default the selector to+ // the default theme (Default Light) so it shows a selected segment, not a+ // blank one. Matches the applied theme — `resolveThemeId("")` is light too.+ selectedThemeId: workspaceProfile.sqlEditorThemeId || DEFAULT_THEME_ID,customDraft: custom? {id: custom.id,