When using actions on html event handlers, for example:
<input value={{editor.strokeWidth}}
oninput={{action (mut editor.strokeWidth) value=target.value}}>
Is there a way to convert target.value declaratively into a template?
In particular, for some editor values I need parseInt, for others parseFloat.
I would like to be able to do something like this (doesn't work, but passes what I want to accomplish):
<input value={{editor.strokeWidth}}
oninput={{action (mut editor.strokeWidth) value=(as-float target.value)}}>
given that I have an as-float helper defined.
The reason I want to avoid conversion in the editor object is because this object is a proxy for a third-party object that has api with a large surface area; if a third-party api adds properties, I don’t want the users of my add-on to have to wait for the update to be able to add input that refers to them.
source
share