Skip to content

Commit

Permalink
fix: apply new node value on blur (fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgii.rychko committed Jun 29, 2016
1 parent 5732a92 commit 378a36f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/editable/node-editable.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ export class NodeEditableDirective implements OnInit {

@HostListener('keyup.enter', ['$event.target.value'])
private applyNewValue(newNodeValue: string) {
return this.valueChanged.emit({type: 'keyup', value: newNodeValue});
this.valueChanged.emit({type: 'keyup', value: newNodeValue});
}

@HostListener('keyup.esc')
private cancelEditing() {
return this.valueChanged.emit({
type: 'keyup',
value: this.nodeValue,
action: NodeEditableEventAction.Cancel
});
@HostListener('blur', ['$event.target.value'])
private applyNewValueByLoosingFocus(newNodeValue: string): void {
this.valueChanged.emit({type: 'blur', value: newNodeValue});
}

@HostListener('blur')
private cancelEditingByLoosingFocus() {
@HostListener('keyup.esc')
private cancelEditing(): void {
this.valueChanged.emit({
type: 'blur',
value: this.nodeValue,
type: 'keyup',
value: this.nodeValue,
action: NodeEditableEventAction.Cancel
});
}
Expand Down

0 comments on commit 378a36f

Please sign in to comment.