-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getInitialBody allow HTML #134
Comments
you can prevent HTML escaping with $! Does this help? |
I can use that via a template instruction, but here I don't see a way of triggering that "flag" via the I could also just pass the html along in the state and then use the $! construct in the template, but that isn't ideal for my case. I'd much rather just use the |
Hey @sandro-pasquali, thanks for the feedback! I just double checked the code and it looks like we are automatically escaping the string as a precaution: That may have not been the most intuitive decision, but maybe the following workaround would work for you?: getInitialBody: function(input, out) {
return function(out) {
out.write('foo<p>bar</p>');
}
} We wouldn't be able to change the existing behavior without risking breaking existing code, but it may be worth considering introducing a new Please let me know what you think. |
@patrick-steele-idem The workaround you've provided works great. Thanks. Default escaping is fine (and you're probably right to escape first and ask questions later). As long as it's documented the given workaround is probably enough -- it's reasonable and easy to understand. Thanks again. |
Great library.
I'm using the following in my widget constructor to inject some HTML into the
<span w-body></span>
injection point of the widget body/template:However, the HTML is rendered escaped (
foo<p>bar</p>
is displayed, rather than being rendered as HTML)In templates I can use the
$!{data.name}!
sequence to avoid escaping HTML. Is there something similar here? Or maybe a better way to dynamically inject content into the widget body?The text was updated successfully, but these errors were encountered: