From f3cfb328184b88d274b6cb052a5877840872a844 Mon Sep 17 00:00:00 2001 From: nick_shcherba Date: Fri, 4 Jan 2019 10:20:59 +0300 Subject: [PATCH] feat: send blur event from summernote and mark controll as touched. #13 --- .../ngx-summernote/src/lib/ngx-summernote.directive.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/projects/ngx-summernote/src/lib/ngx-summernote.directive.ts b/projects/ngx-summernote/src/lib/ngx-summernote.directive.ts index ea226e9..96fd411 100644 --- a/projects/ngx-summernote/src/lib/ngx-summernote.directive.ts +++ b/projects/ngx-summernote/src/lib/ngx-summernote.directive.ts @@ -34,6 +34,8 @@ export class NgxSummernoteDirective implements ControlValueAccessor, OnInit, OnD // summernoteInit directive as output: send manual editor initialization @Output() summernoteInit: EventEmitter = new EventEmitter(); + @Output() blur: EventEmitter = new EventEmitter(); + @Input() ngxSummernoteDisabled: boolean; private _options: any = { @@ -189,6 +191,13 @@ export class NgxSummernoteDirective implements ControlValueAccessor, OnInit, OnD }, 0); }); + this._$element.on('summernote.blur', function () { + setTimeout(function () { + self.onTouched(); + self.blur.emit(); + }, 0); + }); + if (this._options.immediateAngularModelUpdate) { this._editor.on('keyup', function () { setTimeout(function () {