From 1b8c35ab87ce7ea24d00d13faddba9daf9f2ab39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Fri, 31 Mar 2023 11:23:16 +0200 Subject: [PATCH] feat(editor): Allow `tab` to accept completion (#5855) :zap: Allow `tab` to accept completion --- .../ExpressionEditorModal/ExpressionEditorModalInput.vue | 3 ++- .../InlineExpressionEditor/InlineExpressionEditorInput.vue | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/editor-ui/src/components/ExpressionEditorModal/ExpressionEditorModalInput.vue b/packages/editor-ui/src/components/ExpressionEditorModal/ExpressionEditorModalInput.vue index 925e9fae0c0ec..ad790ff2fa808 100644 --- a/packages/editor-ui/src/components/ExpressionEditorModal/ExpressionEditorModalInput.vue +++ b/packages/editor-ui/src/components/ExpressionEditorModal/ExpressionEditorModalInput.vue @@ -16,7 +16,7 @@ import { n8nLang } from '@/plugins/codemirror/n8nLang'; import { highlighter } from '@/plugins/codemirror/resolvableHighlighter'; import { inputTheme } from './theme'; import { forceParse } from '@/utils/forceParse'; -import { autocompletion } from '@codemirror/autocomplete'; +import { acceptCompletion, autocompletion } from '@codemirror/autocomplete'; import type { IVariableItemSelected } from '@/Interface'; @@ -44,6 +44,7 @@ export default mixins(expressionManager, completionManager, workflowHelpers).ext autocompletion(), Prec.highest( keymap.of([ + { key: 'Tab', run: acceptCompletion }, { any: (_: EditorView, event: KeyboardEvent) => { if (event.key === 'Escape') { diff --git a/packages/editor-ui/src/components/InlineExpressionEditor/InlineExpressionEditorInput.vue b/packages/editor-ui/src/components/InlineExpressionEditor/InlineExpressionEditorInput.vue index e14da78aa51a5..62831f6b9e9ec 100644 --- a/packages/editor-ui/src/components/InlineExpressionEditor/InlineExpressionEditorInput.vue +++ b/packages/editor-ui/src/components/InlineExpressionEditor/InlineExpressionEditorInput.vue @@ -8,7 +8,7 @@ import { mapStores } from 'pinia'; import { EditorView, keymap } from '@codemirror/view'; import { EditorState, Prec } from '@codemirror/state'; import { history, redo } from '@codemirror/commands'; -import { autocompletion, completionStatus } from '@codemirror/autocomplete'; +import { acceptCompletion, autocompletion, completionStatus } from '@codemirror/autocomplete'; import { useNDVStore } from '@/stores/ndv'; import { workflowHelpers } from '@/mixins/workflowHelpers'; @@ -78,6 +78,7 @@ export default mixins(completionManager, expressionManager, workflowHelpers).ext inputTheme({ isSingleLine: this.isSingleLine }), Prec.highest( keymap.of([ + { key: 'Tab', run: acceptCompletion }, { any(view: EditorView, event: KeyboardEvent) { if (event.key === 'Escape' && completionStatus(view.state) !== null) {