Allow overriding keydown.enter action when inline editing
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 867
- PR merge metrics
- No merged PRs in 30d
Description
When input editor.type is "input" or "textarea", ENTER key will trigger saving, and such behavior is hard-coded in [src/ng2-smart-table/components/cell/cell-editors/input-editor.component.ts](https://github.com/akveo/ng2-smart-table/blob/53ea3a9c3229400a9bfcc64665298d543e0c27d2/src/ng2-smart-table/components/cell/cell-editors/input-editor.component.ts#L16):
```
(keydown.enter)="onEdited.emit($event)"
```
This variable `$event` is passed all the way up, not exposed or processed but discarded at [src/ng2-smart-table/components/cell/cell.component.ts](https://github.com/akveo/ng2-smart-table/blob/53ea3a9c3229400a9bfcc64665298d543e0c27d2/src/ng2-smart-table/components/cell/cell.component.ts#L31), so we cannot change this behavior:
```
onEdited(event: any) {
if (this.isNew) {
this.grid.create(this.grid.getNewRow(), this.createConfirm);
} else {
this.grid.save(this.row, this.editConfirm);
}
}
```
This is a problem in the following situations:
* When typing non-alphabetic languages like Chinese, ENTER key can be part of the typing process (e.g. charactor selection). If this happens, inputing process is interupted and intermediate content saved unwantedly.
* In textarea mode, it is likely that you want to input multiline text. Then when you try to break a line by pressing ENTER key, it will save instead, also unwantedly.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.