Jsoneditor: Emit the focus and blur event?

Created on 5 Jul 2019  路  9Comments  路  Source: josdejong/jsoneditor

Hi,
Can you support emitting the focus and blur event?

feature help wanted

All 9 comments

Thanks for your suggestion. That could make sense.

Can you explain your use case, why do you need this?

Because I need to change some UI when the jsoneditor is focused, such as border color. And restore to default UI when blurred.

In my case, i put the jsoneditor in a form which consists some input element锛宭ike the demo below.
In general锛宼he input element's border color will changed when hovered or focused.
So i hope the jsoneditor could keep the same style with input element.

image

Ah, now I fully understand what you mean, thanks for the explanation. I was initially assuming that you meant focus/blur of a node, but you mean focus/blur of the editor as a whole. So this should work for all of the modes of the editor.

Yes, I mean focus/blur of the editor as a whole.
Can this be added?

Yes, makes sense to me. I will not have time to implement it my self it any time soon though.

Anyone interested in implementing this feature?

@josdejong, can I give it a try?

Thanks for your offer Survesh, that would be great!

@josdejong I have created a PR exposing the onFocus and onBlur events. Can you check if the approach I have taken is ok and tell me if anything has to be changed?

The new onFocus and onBlur implemented by @123survesh are now published in v7.3.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanmayrajani picture tanmayrajani  路  4Comments

guiferrpereira picture guiferrpereira  路  6Comments

jaunt picture jaunt  路  4Comments

maiscourt picture maiscourt  路  5Comments

PeterBurner picture PeterBurner  路  3Comments