danhper / atomic-chrome

Edit Chrome textareas in Atom
https://goo.gl/Et0hwg
MIT License
917 stars 30 forks source link

Does not trigger events #21

Open gunn opened 8 years ago

gunn commented 8 years ago

Great project! It would be even nicer if when a textfield was edited, the onchange event fired.

My use case is for editing markup that is previewed as html and updates live with typing.

danhper commented 8 years ago

@gunn Hi, thanks for the feedback! For now the keypress event is fired, but I am not sure that firing the onchange event everytime is a great idea, as it differs from the normal behavior of a textarea or input, where it fires only when the input is unfocused. Maybe we could use a keyboard shortcut to fire it from Atom? What do you think?

gunn commented 8 years ago

@tuvistavie yes I think you're right that always firing onchange would be inconsistent.

The reason I was thinking that is because of React's onChange attribute.

Here's a very simple test-case for working with a React textarea - http://output.jsbin.com/funonayaki Source here. You can see it updates correctly when typing in the browser, but not from atom. Maybe the oninput event would be the correct one?