refactor(editor): Update Code node editor for native Python runner (#18538)

This commit is contained in:
Iván Ovejero
2025-08-19 13:40:02 +02:00
committed by GitHub
parent 5c53c22d0a
commit fabbddefdc
7 changed files with 52 additions and 18 deletions

View File

@@ -11,7 +11,6 @@ import type {
} from '@/Interface';
import type {
CodeExecutionMode,
CodeNodeEditorLanguage,
EditorType,
IDataObject,
ILoadOptions,
@@ -24,6 +23,7 @@ import type {
} from 'n8n-workflow';
import { CREDENTIAL_EMPTY_VALUE, isResourceLocatorValue, NodeHelpers } from 'n8n-workflow';
import type { CodeNodeLanguageOption } from '@/components/CodeNodeEditor/CodeNodeEditor.vue';
import CodeNodeEditor from '@/components/CodeNodeEditor/CodeNodeEditor.vue';
import CredentialsSelect from '@/components/CredentialsSelect.vue';
import ExpressionEditModal from '@/components/ExpressionEditModal.vue';
@@ -259,10 +259,12 @@ const editorIsReadOnly = computed<boolean>(() => {
return getTypeOption<boolean>('editorIsReadOnly') ?? false;
});
const editorLanguage = computed<CodeNodeEditorLanguage>(() => {
if (editorType.value === 'json' || props.parameter.type === 'json')
return 'json' as CodeNodeEditorLanguage;
return getTypeOption<CodeNodeEditorLanguage>('editorLanguage') ?? 'javaScript';
const editorLanguage = computed<CodeNodeLanguageOption>(() => {
if (editorType.value === 'json' || props.parameter.type === 'json') return 'json';
if (node.value?.parameters?.language === 'pythonNative') return 'pythonNative';
return getTypeOption<CodeNodeLanguageOption>('editorLanguage') ?? 'javaScript';
});
const codeEditorMode = computed<CodeExecutionMode>(() => {