diff --git a/app/client/src/components/editorComponents/CodeEditor/index.tsx b/app/client/src/components/editorComponents/CodeEditor/index.tsx index bc2bd9095a..33071e9534 100644 --- a/app/client/src/components/editorComponents/CodeEditor/index.tsx +++ b/app/client/src/components/editorComponents/CodeEditor/index.tsx @@ -157,6 +157,7 @@ import { debug } from "loglevel"; import { PeekOverlayExpressionIdentifier, SourceType } from "@shared/ast"; import type { MultiplexingModeConfig } from "components/editorComponents/CodeEditor/modes"; import { MULTIPLEXING_MODE_CONFIGS } from "components/editorComponents/CodeEditor/modes"; +import { getDeleteLineShortcut } from "./utils/deleteLine"; type ReduxStateProps = ReturnType; type ReduxDispatchProps = ReturnType; @@ -379,6 +380,9 @@ class CodeEditor extends Component { saveAndAutoIndentCode(editor); AnalyticsUtil.logEvent("PRETTIFY_AND_SAVE_KEYBOARD_SHORTCUT"); }, + [getDeleteLineShortcut()]: () => { + return; + }, }; if (this.props.tabBehaviour === TabBehaviour.INPUT) { diff --git a/app/client/src/components/editorComponents/CodeEditor/utils/deleteLine.ts b/app/client/src/components/editorComponents/CodeEditor/utils/deleteLine.ts new file mode 100644 index 0000000000..faa4640d64 --- /dev/null +++ b/app/client/src/components/editorComponents/CodeEditor/utils/deleteLine.ts @@ -0,0 +1,7 @@ +import { getPlatformOS } from "utils/helpers"; +import { KEYBOARD_SHORTCUTS_BY_PLATFORM } from "./keyboardShortcutConstants"; + +export const getDeleteLineShortcut = () => { + const platformOS = getPlatformOS() || "default"; + return KEYBOARD_SHORTCUTS_BY_PLATFORM[platformOS].deleteLine; +}; diff --git a/app/client/src/components/editorComponents/CodeEditor/utils/keyboardShortcutConstants.ts b/app/client/src/components/editorComponents/CodeEditor/utils/keyboardShortcutConstants.ts index 98bb6d42d4..60141b6d63 100644 --- a/app/client/src/components/editorComponents/CodeEditor/utils/keyboardShortcutConstants.ts +++ b/app/client/src/components/editorComponents/CodeEditor/utils/keyboardShortcutConstants.ts @@ -7,6 +7,7 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Cmd-P", autoIndentShortcutText: "Shift + Cmd + P", codeComment: "Cmd-/", + deleteLine: "Cmd-D", }, [PLATFORM_OS.IOS]: { saveAndAutoIndent: "Cmd-S", @@ -14,6 +15,7 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Cmd-P", autoIndentShortcutText: "Shift + Cmd + P", codeComment: "Cmd-/", + deleteLine: "Cmd-D", }, [PLATFORM_OS.WINDOWS]: { saveAndAutoIndent: "Ctrl-S", @@ -21,6 +23,7 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Alt-F", autoIndentShortcutText: "Shift + Alt + F", codeComment: "Ctrl-/", + deleteLine: "Ctrl-D", }, [PLATFORM_OS.ANDROID]: { saveAndAutoIndent: "Ctrl-S", @@ -28,6 +31,7 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Alt-F", autoIndentShortcutText: "Shift + Alt + F", codeComment: "Ctrl-/", + deleteLine: "Ctrl-D", }, [PLATFORM_OS.LINUX]: { saveAndAutoIndent: "Ctrl-S", @@ -35,6 +39,7 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Ctrl-I", autoIndentShortcutText: "Shift + Ctrl + I", codeComment: "Ctrl-/", + deleteLine: "Ctrl-D", }, default: { saveAndAutoIndent: "Ctrl-S", @@ -42,5 +47,6 @@ export const KEYBOARD_SHORTCUTS_BY_PLATFORM = { autoIndentShortcut: "Shift-Alt-F", autoIndentShortcutText: "Shift + Alt + F", codeComment: "Ctrl-/", + deleteLine: "Ctrl-D", }, };