From c63f365a658031fcb51202f062fe3e66885f9058 Mon Sep 17 00:00:00 2001 From: Arpad Gabor Date: Sat, 23 Oct 2021 18:38:46 +0300 Subject: [PATCH 01/16] feat: replace function node code editor with monaco --- packages/editor-ui/package.json | 4 +- .../editor-ui/src/components/CodeEdit.vue | 128 ++++++++++++------ .../src/components/ParameterInput.vue | 4 +- packages/editor-ui/vue.config.js | 5 + 4 files changed, 97 insertions(+), 44 deletions(-) diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 2f381b5740..69eb7c1521 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -27,6 +27,7 @@ "dependencies": { "@fontsource/open-sans": "^4.5.0", "n8n-design-system": "~0.5.0", + "monaco-editor": "^0.29.1", "timeago.js": "^4.0.2", "v-click-outside": "^3.1.2", "vue-fragment": "^1.5.2" @@ -72,11 +73,12 @@ "lodash.get": "^4.4.2", "lodash.set": "^4.3.2", "n8n-workflow": "~0.73.0", - "sass": "^1.26.5", + "monaco-editor-webpack-plugin": "^5.0.0", "normalize-wheel": "^1.0.1", "prismjs": "^1.17.1", "quill": "^2.0.0-dev.3", "quill-autoformat": "^0.1.1", + "sass": "^1.26.5", "sass-loader": "^8.0.2", "string-template-parser": "^1.2.6", "ts-jest": "^26.3.0", diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index fb1c02521d..85c7cc1c25 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -1,61 +1,107 @@ diff --git a/packages/editor-ui/src/components/ParameterInput.vue b/packages/editor-ui/src/components/ParameterInput.vue index 5ea58f5f4c..30008448ad 100644 --- a/packages/editor-ui/src/components/ParameterInput.vue +++ b/packages/editor-ui/src/components/ParameterInput.vue @@ -13,7 +13,7 @@ />
- +
@@ -597,7 +597,7 @@ export default mixins( parameter_field_type: this.parameter.type, new_expression: !this.isValueExpression, workflow_id: this.$store.getters.workflowId, - }); + }); } }, closeTextEditDialog () { diff --git a/packages/editor-ui/vue.config.js b/packages/editor-ui/vue.config.js index d1233395fe..ef36eb00bc 100644 --- a/packages/editor-ui/vue.config.js +++ b/packages/editor-ui/vue.config.js @@ -1,3 +1,5 @@ +const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); + module.exports = { chainWebpack: config => config.resolve.symlinks(false), // transpileDependencies: [ @@ -13,6 +15,9 @@ module.exports = { devServer: { disableHostCheck: true, }, + plugins: [ + new MonacoWebpackPlugin(), + ], }, css: { loaderOptions: { From 7a020d079fa564f895564c14339df2617ce470f5 Mon Sep 17 00:00:00 2001 From: Arpad Gabor Date: Sat, 23 Oct 2021 18:39:34 +0300 Subject: [PATCH 02/16] fix: set autocomplete data as empty array --- packages/editor-ui/src/components/CodeEdit.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index 85c7cc1c25..b3cfac943e 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -71,7 +71,7 @@ export default mixins(genericHelpers).extend({ loadAutocompleteData(): void { const executedWorkflow: IExecutionResponse | null = this.$store.getters.getWorkflowExecution; - let autocompleteData: INodeExecutionData[] = [{ json: { myNewField: 2 } }]; + let autocompleteData: INodeExecutionData[] = []; if (executedWorkflow) { const lastNodeExecuted = executedWorkflow.data.resultData.lastNodeExecuted; From 62f0899e100b11ba45509df796c1c5d342b1c78d Mon Sep 17 00:00:00 2001 From: Arpad Gabor Date: Sat, 23 Oct 2021 18:48:45 +0300 Subject: [PATCH 03/16] fix: forgot readonly to editor --- packages/editor-ui/src/components/CodeEdit.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index b3cfac943e..3a32ed7862 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -54,6 +54,7 @@ export default mixins(genericHelpers).extend({ value: this.value, language: 'javascript', tabSize: 2, + readOnly: this.isReadOnly, }); this.monacoInstance.onDidChangeModelContent((ev) => { From f811992527e15aa310fcef1603a69776adff6a7c Mon Sep 17 00:00:00 2001 From: Arpad Gabor Date: Sat, 23 Oct 2021 19:06:02 +0300 Subject: [PATCH 04/16] fix: monaco build problems --- packages/editor-ui/src/components/CodeEdit.vue | 11 +++++------ packages/editor-ui/vue.config.js | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index 3a32ed7862..b5bfd9a94e 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -57,12 +57,11 @@ export default mixins(genericHelpers).extend({ readOnly: this.isReadOnly, }); - this.monacoInstance.onDidChangeModelContent((ev) => { - if (this.monacoInstance) { - const model = this.monacoInstance.getModel(); - if (model) { - this.$emit('valueChanged', model.getValue()); - } + this.monacoInstance.onDidChangeModelContent(() => { + const model = this.monacoInstance!.getModel(); + + if (model) { + this.$emit('valueChanged', model.getValue()); } }); diff --git a/packages/editor-ui/vue.config.js b/packages/editor-ui/vue.config.js index ef36eb00bc..6f2e10804c 100644 --- a/packages/editor-ui/vue.config.js +++ b/packages/editor-ui/vue.config.js @@ -16,7 +16,7 @@ module.exports = { disableHostCheck: true, }, plugins: [ - new MonacoWebpackPlugin(), + new MonacoWebpackPlugin({ languages: ['javascript', 'html', 'typescript'] }), ], }, css: { @@ -28,5 +28,5 @@ module.exports = { }, }, }, - publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/', + publicPath: process.env.VUE_APP_PUBLIC_PATH && process.env.VUE_APP_PUBLIC_PATH !== '/%BASE_PATH%/' ? process.env.VUE_APP_PUBLIC_PATH : '/', }; From 5fa004dbc6b4d5ef2f47626ce96a085ca2c137eb Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sat, 4 Dec 2021 10:36:21 +0100 Subject: [PATCH 05/16] :zap: Fix build issues --- packages/cli/src/telemetry/index.ts | 2 ++ packages/cli/tsconfig.json | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index fb38ed257d..105b4ac123 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -135,10 +135,12 @@ export class Telemetry { async track(eventName: string, properties?: IDataObject): Promise { return new Promise((resolve) => { if (this.client) { + // @ts-ignore this.client.track( { userId: this.instanceId, event: eventName, + // @ts-ignore properties, }, resolve, diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index aa44bc610f..a603b7e8d0 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -11,6 +11,7 @@ "module": "commonjs", "noImplicitAny": true, "removeComments": true, + "skipLibCheck": true, "strictNullChecks": true, "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, From 291c5154c61be8bd052d221f5b5c311562a8bcd2 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Mon, 20 Dec 2021 23:41:45 +0100 Subject: [PATCH 06/16] :zap: Change background color and add $json autocomplete --- .../editor-ui/src/components/CodeEdit.vue | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/components/CodeEdit.vue b/packages/editor-ui/src/components/CodeEdit.vue index bc4ac6fb45..990d04123d 100644 --- a/packages/editor-ui/src/components/CodeEdit.vue +++ b/packages/editor-ui/src/components/CodeEdit.vue @@ -14,8 +14,6 @@