import { Component , Input , Output , EventEmitter } from '@angular/core' ; @ Component ( { selector : 'tb-inline-edit' , templateUrl : './inline-edit.component.html' } ) export class InlineEditComponent { public isDisplay = true ; @ Input ( ) text : string ; @ Input ( ) isTextarea : boolean ; @ Output ( ) edit = new EventEmitter < string > ( ) ; beginEdit ( el ) { this . isDisplay = false ; setTimeout ( ( ) => { el . focus ( ) ; } , 100 ) ; } editDone ( newText , event ? ) { this . isDisplay = true ; this . text = newText ; this . edit . emit ( this . text ) ; if ( event && event . stopPropagation ) { event . stopPropagation ( ) ; } } }