From c9f3acc8485edd0adbde4a633318a01b018d6fc0 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 31 Jul 2023 12:41:30 +0300 Subject: [PATCH] fix(editor): Prevent text edit dialog from re-opening in same tick (#6781) * fix: prevent reopenning textedit dialog in same tick * fix: add same logic for code edit dialog * fix: remove stop modifier * fix: blur input field when closing modal, removing default element-plus behaviour --- .../src/components/ParameterInput.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/src/components/ParameterInput.vue b/packages/editor-ui/src/components/ParameterInput.vue index 39bb67a18d..2209b06fda 100644 --- a/packages/editor-ui/src/components/ParameterInput.vue +++ b/packages/editor-ui/src/components/ParameterInput.vue @@ -486,6 +486,7 @@ export default defineComponent({ remoteParameterOptionsLoading: false, remoteParameterOptionsLoadingIssues: null as string | null, textEditDialogVisible: false, + editDialogClosing: false, tempValue: '', // el-date-picker and el-input does not seem to work without v-model so add one CUSTOM_API_CALL_KEY, activeCredentialType: '', @@ -922,6 +923,11 @@ export default defineComponent({ }, closeCodeEditDialog() { this.codeEditDialogVisible = false; + + this.editDialogClosing = true; + void this.$nextTick(() => { + this.editDialogClosing = false; + }); }, closeExpressionEditDialog() { this.expressionEditDialogVisible = false; @@ -945,8 +951,18 @@ export default defineComponent({ }, closeTextEditDialog() { this.textEditDialogVisible = false; + + this.editDialogClosing = true; + void this.$nextTick(() => { + this.$refs.inputField?.blur?.(); + this.editDialogClosing = false; + }); }, displayEditDialog() { + if (this.editDialogClosing) { + return; + } + if (this.editorType) { this.codeEditDialogVisible = true; } else { @@ -975,7 +991,7 @@ export default defineComponent({ onResourceLocatorDrop(data: string) { this.$emit('drop', data); }, - async setFocus() { + async setFocus(event: MouseEvent) { if (['json'].includes(this.parameter.type) && this.getArgument('alwaysOpenEditWindow')) { this.displayEditDialog(); return;