Skip to content

Commit

Permalink
Issue openmediavault#1760: Add python support to codeEditor component
Browse files Browse the repository at this point in the history
Fixes: openmediavault#1760
Signed-off-by: Volker Theile <votdev@gmx.de>
  • Loading branch information
votdev committed May 6, 2024
1 parent 5d532df commit 0d54997
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
57 changes: 51 additions & 6 deletions deb/openmediavault/workbench/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions deb/openmediavault/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@codemirror/autocomplete": "^6.16.0",
"@codemirror/commands": "^6.5.0",
"@codemirror/lang-json": "^6.0.1",
"@codemirror/lang-python": "^6.1.6",
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/language": "^6.10.1",
"@codemirror/legacy-modes": "^6.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from '@codemirror/autocomplete';
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
import { json } from '@codemirror/lang-json';
import { python } from '@codemirror/lang-python';
import { xml } from '@codemirror/lang-xml';
import {
bracketMatching,
Expand Down Expand Up @@ -131,7 +132,7 @@ export class MatFormCodeEditorComponent
lineNumbers?: boolean = true;

@Input()
language?: 'json' | 'shell' | 'xml' | 'yaml';
language?: 'json' | 'python' | 'shell' | 'xml' | 'yaml';

@Input()
get value(): string {
Expand Down Expand Up @@ -346,9 +347,10 @@ export class MatFormCodeEditorComponent
private getLanguageExtensions(): Extension {
return _.isString(this.language)
? {
xml: xml(),
json: json(),
python: python(),
shell: StreamLanguage.define(shell),
xml: xml(),
yaml: StreamLanguage.define(yaml)
}[this.language]
: [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export type FormFieldConfig = {

// --- codeEditor ---
lineNumbers?: boolean;
language?: 'json' | 'shell' | 'xml' | 'yaml';
language?: 'json' | 'python' | 'shell' | 'xml' | 'yaml';

// --- fileInput ---
// Takes a comma-separated list of one or more file types, or
Expand Down

0 comments on commit 0d54997

Please sign in to comment.