mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat(editor): Allow tab
to accept completion (#5855)
⚡ Allow `tab` to accept completion
This commit is contained in:
parent
f7f9d915b1
commit
1b8c35ab87
|
@ -16,7 +16,7 @@ import { n8nLang } from '@/plugins/codemirror/n8nLang';
|
||||||
import { highlighter } from '@/plugins/codemirror/resolvableHighlighter';
|
import { highlighter } from '@/plugins/codemirror/resolvableHighlighter';
|
||||||
import { inputTheme } from './theme';
|
import { inputTheme } from './theme';
|
||||||
import { forceParse } from '@/utils/forceParse';
|
import { forceParse } from '@/utils/forceParse';
|
||||||
import { autocompletion } from '@codemirror/autocomplete';
|
import { acceptCompletion, autocompletion } from '@codemirror/autocomplete';
|
||||||
|
|
||||||
import type { IVariableItemSelected } from '@/Interface';
|
import type { IVariableItemSelected } from '@/Interface';
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ export default mixins(expressionManager, completionManager, workflowHelpers).ext
|
||||||
autocompletion(),
|
autocompletion(),
|
||||||
Prec.highest(
|
Prec.highest(
|
||||||
keymap.of([
|
keymap.of([
|
||||||
|
{ key: 'Tab', run: acceptCompletion },
|
||||||
{
|
{
|
||||||
any: (_: EditorView, event: KeyboardEvent) => {
|
any: (_: EditorView, event: KeyboardEvent) => {
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { mapStores } from 'pinia';
|
||||||
import { EditorView, keymap } from '@codemirror/view';
|
import { EditorView, keymap } from '@codemirror/view';
|
||||||
import { EditorState, Prec } from '@codemirror/state';
|
import { EditorState, Prec } from '@codemirror/state';
|
||||||
import { history, redo } from '@codemirror/commands';
|
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 { useNDVStore } from '@/stores/ndv';
|
||||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||||
|
@ -78,6 +78,7 @@ export default mixins(completionManager, expressionManager, workflowHelpers).ext
|
||||||
inputTheme({ isSingleLine: this.isSingleLine }),
|
inputTheme({ isSingleLine: this.isSingleLine }),
|
||||||
Prec.highest(
|
Prec.highest(
|
||||||
keymap.of([
|
keymap.of([
|
||||||
|
{ key: 'Tab', run: acceptCompletion },
|
||||||
{
|
{
|
||||||
any(view: EditorView, event: KeyboardEvent) {
|
any(view: EditorView, event: KeyboardEvent) {
|
||||||
if (event.key === 'Escape' && completionStatus(view.state) !== null) {
|
if (event.key === 'Escape' && completionStatus(view.state) !== null) {
|
||||||
|
|
Loading…
Reference in a new issue