When using actions on html event handlers, for example:
<input value={{editor.strokeWidth}}
oninput={{action (mut editor.strokeWidth) value=target.value}}>
is there any way to transform target.value declaratively in the template?
In particular, for some editor values I need to parseInt, for others parseFloat.
I'd like to be able to do something like this (non-working, but conveys 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, doing the transformation in the editor object is that that object is a proxy for a third party object which has an api with a large surface area; if the third party api adds properties I don't want users of my add-on to have to wait for an update to be able to add inputs that access them.
Aucun commentaire:
Enregistrer un commentaire