Skip to content

Commit

Permalink
fix: blur and focus inside zone
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed Mar 26, 2018
1 parent b1be123 commit 4a02011
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lib/codemirror.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,16 @@ export class CodemirrorComponent
this.codeMirror = fromTextArea(this.ref.nativeElement, this._options);
this.codeMirror.on('cursorActivity', this.cursorActive.bind(this));
this.codeMirror.on('scroll', this.scrollChanged.bind(this));
this.codeMirror.on('blur', this.focusChanged.bind(this, false));
this.codeMirror.on('focus', this.focusChanged.bind(this, true));
this.codeMirror.on('change', (cm: Editor, change: EditorChangeLinkedList) =>
this._ngZone.run(() => this.codemirrorValueChanged(cm, change))
this.codeMirror.on('blur', () =>
this._ngZone.run(() => this.focusChanged(false)),
);
this.codeMirror.on('focus', () =>
this._ngZone.run(() => this.focusChanged(true)),
);
this.codeMirror.on(
'change',
(cm: Editor, change: EditorChangeLinkedList) =>
this._ngZone.run(() => this.codemirrorValueChanged(cm, change)),
);
this.codeMirror.setValue(this.value);
});
Expand Down

0 comments on commit 4a02011

Please sign in to comment.