feat(editor): add toggle case shortcut for selection
This commit is contained in:
1 parent
eeeea648c1
commit
f47c209b15
21 files changed
+111
-3
No files matched your search
@@ -2124,6 +2124,7 @@ const formatterEditorShortcutIds: ShortcutActionId[] = [
|
||||
"selectAll",
|
||||
"uppercaseSelection",
|
||||
"lowercaseSelection",
|
||||
"toggleCaseSelection",
|
||||
"toggleFold",
|
||||
"foldAll",
|
||||
"unfoldAll",
|
||||
|
||||
@@ -1396,6 +1396,7 @@ function runKeymapExtension(codeMirrorKeymap: (typeof import("@codemirror/view")
|
||||
...binding(shortcuts.selectAllSelectionOccurrences, selectAllQueryEditorSelectionOccurrences),
|
||||
...createQueryEditorSelectionCaseShortcutBindings(shortcuts.uppercaseSelection, () => convertSelectedSqlCase("upper")),
|
||||
...createQueryEditorSelectionCaseShortcutBindings(shortcuts.lowercaseSelection, () => convertSelectedSqlCase("lower")),
|
||||
...createQueryEditorSelectionCaseShortcutBindings(shortcuts.toggleCaseSelection, () => convertSelectedSqlCase("toggle")),
|
||||
...createQueryEditorSelectionCaseShortcutBindings(shortcuts.convertNamingStyle, () => convertSelectedNamingStyle()),
|
||||
...binding(shortcuts.toggleLineComment, (view) => codeMirrorRuntime.codeMirrorToggleLineComment?.(view) ?? false),
|
||||
...binding(shortcuts.toggleBlockComment, (view) => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {
|
||||
AlignLeft,
|
||||
ArrowDownUp,
|
||||
Camera,
|
||||
CaseLower,
|
||||
CaseSensitive,
|
||||
@@ -39,6 +40,7 @@ import { supportsQueryEditorBlockComments } from "@/lib/database/databaseFeature
|
||||
import { normalizeShortcutSettings, type ShortcutSettings } from "@/lib/editor/shortcutRegistry";
|
||||
import { queryContextObjectActions, type QueryContextObjectAction } from "@/lib/sql/queryCursorTableTarget";
|
||||
import type { SqlObjectNavigationTarget } from "@/lib/sql/sqlNavigation";
|
||||
import type { SqlSelectionCaseMode } from "@/lib/sql/sqlSelectionCase";
|
||||
import type { QueryEditorProps } from "./queryEditorTypes";
|
||||
|
||||
export interface QueryEditorContextMenuState {
|
||||
@@ -70,7 +72,7 @@ export interface QueryEditorContextMenuActions {
|
||||
cutSelectedSqlFromContextMenu: () => void;
|
||||
pasteClipboardSqlFromContextMenu: () => void;
|
||||
pasteClipboardSqlRestoringSource: () => void;
|
||||
convertSelectedSqlCase: (mode: "upper" | "lower") => void;
|
||||
convertSelectedSqlCase: (mode: SqlSelectionCaseMode) => void;
|
||||
convertSelectedNamingStyle: () => void;
|
||||
openDelimitedListDialog: () => void;
|
||||
addNextSelectionOccurrenceFromContextMenu: () => void;
|
||||
@@ -300,6 +302,13 @@ const contextMenuItems = computed<ContextMenuItem[]>(() => {
|
||||
icon: Sparkles,
|
||||
shortcut: shortcuts.sendSelectionToAi,
|
||||
},
|
||||
{
|
||||
label: t("editor.contextMenu.toggleCaseSelection"),
|
||||
action: () => actions.convertSelectedSqlCase("toggle"),
|
||||
disabled: !canCopySelectedSql,
|
||||
icon: ArrowDownUp,
|
||||
shortcut: shortcuts.toggleCaseSelection,
|
||||
},
|
||||
{
|
||||
label: t("editor.contextMenu.uppercaseSelection"),
|
||||
action: () => actions.convertSelectedSqlCase("upper"),
|
||||
|
||||
Reference in new issue
Block a user