From 9a31e8921b71638bb035e501aedf778384e2109a Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Thu, 23 Apr 2020 12:42:32 -0400 Subject: [PATCH] fix(EditableCell): Change behavior to save cell contents when losing focus, clicking away etc. fix #562 --- lib/editor/components/timetable/EditableCell.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/editor/components/timetable/EditableCell.js b/lib/editor/components/timetable/EditableCell.js index cb959abc3..f09a79080 100644 --- a/lib/editor/components/timetable/EditableCell.js +++ b/lib/editor/components/timetable/EditableCell.js @@ -259,6 +259,10 @@ export default class EditableCell extends Component { } } + handleBlur = () => { + this.save() + } + handleChange = (evt: SyntheticInputEvent) => { this.setState({data: evt.target.value}) } @@ -335,7 +339,7 @@ export default class EditableCell extends Component { autoFocus defaultValue={renderCell(column, data)} className='cell-input' - onBlur={this.cancel} + onBlur={this.handleBlur} onChange={this.handleChange} onFocus={this._onInputFocus} onKeyDown={this.handleKeyDown}