From 47fbf3fb92ba8c5af35514bdfe0e5e83eb3791de Mon Sep 17 00:00:00 2001 From: Kiran Ashok Date: Thu, 27 Jan 2022 20:41:29 +0530 Subject: [PATCH] Mew app creation - v1 should be default name and pressing enter should create version (#1968) * updating default value to app version * typo * bugix toast triggering more than once --- frontend/src/Editor/Editor.jsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 3353a7d4be..a39214dd5d 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -110,7 +110,7 @@ class Editor extends React.Component { socket: null, showInitVersionCreateModal: false, isCreatingInitVersion: false, - initVersionName: null, + initVersionName: 'v1', isSavingEditingVersion: false, showSaveDetail: false, hasAppDefinitionChanged: false, @@ -800,7 +800,12 @@ class Editor extends React.Component { ); }; - + handleKeyPress = (event) => { + if (event.key === 'Enter') { + // eslint-disable-next-line no-undef + this.createInitVersion(); + } + }; createInitVersion = () => { const newVersionName = this.state.initVersionName; const appId = this.state.appId; @@ -844,6 +849,7 @@ class Editor extends React.Component { enforceFocus={false} animation={false} centered={true} + // eslint-disable-next-line no-undef > Create Version @@ -855,7 +861,9 @@ class Editor extends React.Component { type="text" className="form-control" placeholder="version name" + defaultValue={this.state.initVersionName} onChange={(e) => this.setState({ initVersionName: e.target.value })} + onKeyPress={(e) => this.handleKeyPress(e)} />