fix(editor): Fix redo in code and expression editor (#5708)

* fix(editor): Fix redo in code and expression editor
*  Updating keymap to use platform-specific command key
This commit is contained in:
Milorad FIlipović 2023-03-17 13:23:49 +01:00 committed by GitHub
parent 233f1fa7ec
commit cd7a55ba5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View file

@ -14,6 +14,7 @@ import {
indentWithTab, indentWithTab,
insertNewlineAndIndent, insertNewlineAndIndent,
toggleComment, toggleComment,
redo,
} from '@codemirror/commands'; } from '@codemirror/commands';
import { lintGutter } from '@codemirror/lint'; import { lintGutter } from '@codemirror/lint';
@ -36,6 +37,7 @@ export const baseExtensions = [
{ key: 'Tab', run: acceptCompletion }, { key: 'Tab', run: acceptCompletion },
{ key: 'Enter', run: acceptCompletion }, { key: 'Enter', run: acceptCompletion },
{ key: 'Mod-/', run: toggleComment }, { key: 'Mod-/', run: toggleComment },
{ key: 'Mod-Shift-z', run: redo },
indentWithTab, indentWithTab,
]), ]),
EditorView.lineWrapping, EditorView.lineWrapping,

View file

@ -6,7 +6,7 @@
import mixins from 'vue-typed-mixins'; import mixins from 'vue-typed-mixins';
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 } from '@codemirror/commands'; import { history, redo } from '@codemirror/commands';
import { workflowHelpers } from '@/mixins/workflowHelpers'; import { workflowHelpers } from '@/mixins/workflowHelpers';
import { expressionManager } from '@/mixins/expressionManager'; import { expressionManager } from '@/mixins/expressionManager';
@ -54,6 +54,7 @@ export default mixins(expressionManager, completionManager, workflowHelpers).ext
return false; return false;
}, },
}, },
{ key: 'Mod-Shift-z', run: redo },
]), ]),
), ),
n8nLang(), n8nLang(),

View file

@ -10,7 +10,7 @@ import cssParser from 'prettier/parser-postcss';
import jsParser from 'prettier/parser-babel'; import jsParser from 'prettier/parser-babel';
import { htmlLanguage, autoCloseTags, html } from 'codemirror-lang-html-n8n'; import { htmlLanguage, autoCloseTags, html } from 'codemirror-lang-html-n8n';
import { autocompletion } from '@codemirror/autocomplete'; import { autocompletion } from '@codemirror/autocomplete';
import { indentWithTab, insertNewlineAndIndent, history } from '@codemirror/commands'; import { indentWithTab, insertNewlineAndIndent, history, redo } from '@codemirror/commands';
import { import {
bracketMatching, bracketMatching,
ensureSyntaxTree, ensureSyntaxTree,
@ -86,7 +86,11 @@ export default mixins(expressionManager).extend({
this.disableExpressionCompletions ? html() : htmlWithCompletions(), this.disableExpressionCompletions ? html() : htmlWithCompletions(),
autoCloseTags, autoCloseTags,
expressionInputHandler(), expressionInputHandler(),
keymap.of([indentWithTab, { key: 'Enter', run: insertNewlineAndIndent }]), keymap.of([
indentWithTab,
{ key: 'Enter', run: insertNewlineAndIndent },
{ key: 'Mod-Shift-z', run: redo },
]),
indentOnInput(), indentOnInput(),
theme, theme,
lineNumbers(), lineNumbers(),

View file

@ -7,7 +7,7 @@ import mixins from 'vue-typed-mixins';
import { mapStores } from 'pinia'; 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 } from '@codemirror/commands'; import { history, redo } from '@codemirror/commands';
import { autocompletion, completionStatus } from '@codemirror/autocomplete'; import { autocompletion, completionStatus } from '@codemirror/autocomplete';
import { useNDVStore } from '@/stores/ndv'; import { useNDVStore } from '@/stores/ndv';
@ -87,6 +87,7 @@ export default mixins(completionManager, expressionManager, workflowHelpers).ext
return false; return false;
}, },
}, },
{ key: 'Mod-Shift-z', run: redo },
]), ]),
), ),
autocompletion(), autocompletion(),