fix(editor): Remove explicit parameter name scanning for code editors (#6390)

The correct value to display in an editor is already passed in to `ParameterInput`. We do not need to scan for the correct parameter name again.
This also fixes the issue of us accidentally using `jsCode` as the parameter name in the Code node when the language is set to Python.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-06-06 14:01:26 +02:00 committed by GitHub
parent 78763c8320
commit 97295f67f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,7 @@
<code-node-editor
v-if="editorType === 'codeNodeEditor' && isCodeNode(node)"
:mode="node.parameters.mode"
:value="editorContent"
:value="value"
:defaultValue="parameter.default"
:language="editorLanguage"
:isReadOnly="isReadOnly"
@ -97,7 +97,7 @@
<html-editor
v-else-if="editorType === 'htmlEditor'"
:html="editorContent"
:html="value"
:isReadOnly="isReadOnly"
:rows="getArgument('rows')"
:disableExpressionColoring="!isHtmlNode(node)"
@ -107,7 +107,7 @@
<sql-editor
v-else-if="editorType === 'sqlEditor'"
:query="editorContent"
:query="value"
:dialect="getArgument('sqlDialect')"
:isReadOnly="isReadOnly"
@valueChanged="valueChangedDebounced"
@ -365,7 +365,6 @@ import type {
IParameterLabel,
EditorType,
CodeNodeEditorLanguage,
INodeTypeDescription,
} from 'n8n-workflow';
import { NodeHelpers } from 'n8n-workflow';
@ -821,22 +820,6 @@ export default defineComponent({
remoteParameterOptionsKeys(): string[] {
return (this.remoteParameterOptions || []).map((o) => o.name);
},
nodeType(): INodeTypeDescription | null {
if (!this.node) return null;
return this.nodeTypesStore.getNodeType(this.node.type, this.node.typeVersion);
},
editorContent(): string | undefined {
if (!this.nodeType) {
return;
}
const editorProp = this.nodeType.properties.find(
(p) => p.typeOptions?.editor === (this.editorType as string),
);
if (!editorProp) {
return;
}
return this.node.parameters[editorProp.name] as string;
},
},
methods: {
isRemoteParameterOption(option: INodePropertyOptions) {