yabab-dev / ng2-codemirror

Angular2 CodeMirror component
MIT License
70 stars 30 forks source link

Blur not working #6

Closed brian-avery closed 7 years ago

brian-avery commented 7 years ago

I tried to use blur, which is listed on http://codemirror.net/doc/manual.html#events to detect when the focus is lost on the codemirror object, but my function doesn't get called. Here's a sample:

<codemirror [(ngModel)]="code" name="code" [config]="config" (blur)="focusLost()">

focusLost() { console.log("Focus lost") }

But the blur event never fires. Is this not bubbled up through the component?

Thanks, Brian

yabab-dev commented 7 years ago

Hi,

I've implemented focus and blur events in the @next version

npm install ng2-codemirror@next

imolorhe commented 7 years ago

@chymz Besides the blur and focus events, the other events that are supported by codemirror should be implemented. I currently need to use the keyup event for my project. Could this be added into ng2-codemirror soon?

imolorhe commented 7 years ago

@chymz For now, I am using the ViewChild decorator to access the codemirror instance directly to add the events I need (which is not the ideal way) pending the addition of the other events.