You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, in Marko 4.2.1 a newline is inserted and my cursor jumps to the end of the textarea on every input if I try to bind its value to the state:
custom-input.marko
class {
onChange(e) {
this.emit('change', e.target.value)
}
}
div
textarea key='input' on-input('onChange') value=input.value -- ${input.value}
p
strong -- ${input.value}
If I remove the strong tag that outputs input.value it works fine. If I use an input instead of the textarea it works fine as well. If I remove the ${input.value} from the textarea's body it works as well but then the initial input.value isn't shown.
The code is server-rendered so I'm guessing that this has to do with serialisation maybe?
I haven't had a chance to verify, but it appears that the \n in the concise line is being preserved by the parser and added to the textarea body for every render. A temporary workaround would be to use the HTML syntax for the <textarea> tag:
div
<textarea key='input' on-input('onChange')>${input.value}</textarea>
We'll investigate a fix in Marko. Thanks for reporting the problem.
Hey @patrick-steele-idem! Thank you for your help. I can verify that your proposed workaround of using the HTML syntax works. :)
patrick-steele-idem
changed the title
Binding textarea to state
New line always added to textarea and other elements for single line/delimited HTML blocks
Apr 3, 2017
Hi, in
Marko 4.2.1
a newline is inserted and my cursor jumps to the end of the textarea on every input if I try to bind its value to the state:custom-input.marko
If I remove the strong tag that outputs
input.value
it works fine. If I use aninput
instead of thetextarea
it works fine as well. If I remove the${input.value}
from thetextarea
's body it works as well but then the initialinput.value
isn't shown.The code is server-rendered so I'm guessing that this has to do with serialisation maybe?
Full code: https://github.com/maximilianschmitt/lasso-test
Thanks for your help!
The text was updated successfully, but these errors were encountered: