Skip to content

Commit

Permalink
feat: send blur event from summernote and mark controll as touched. #13
Browse files Browse the repository at this point in the history
  • Loading branch information
NickShcherba committed Jan 4, 2019
1 parent 5d74114 commit ac854e2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions projects/ngx-summernote/src/lib/ngx-summernote.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class NgxSummernoteDirective implements ControlValueAccessor, OnInit, OnD
// summernoteInit directive as output: send manual editor initialization
@Output() summernoteInit: EventEmitter<Object> = new EventEmitter<Object>();

@Output() blur: EventEmitter<any> = new EventEmitter<any>();

@Input() ngxSummernoteDisabled: boolean;

private _options: any = {
Expand Down Expand Up @@ -189,6 +191,13 @@ export class NgxSummernoteDirective implements ControlValueAccessor, OnInit, OnD
}, 0);
});

this._$element.on('summernote.blur', function () {
setTimeout(function () {
self.blur.emit();
self.onTouched();
}, 0);
});

if (this._options.immediateAngularModelUpdate) {
this._editor.on('keyup', function () {
setTimeout(function () {
Expand Down

0 comments on commit ac854e2

Please sign in to comment.