bind-value-oninput
or bind
does not work with contenteditable
divsIn the below code, the expectation is as and when I edit the div content I need to update the model so that I can then save it back to Database.
Steps to reproduce the behavior:
<div contenteditable="true" bind-value-oninput="@contentEditableText">
You can Edit this Text
</div>
@contentEditableText
@functions {
string contentEditableText = "You can Edit this Text";
}
OnChange Event needs to fire and changes in editable div should be bound to the model.
We don't currently support bind
with contenteditable
. It might be something we add in the future, but it's not directly planned.
In the meantime, you can use contenteditable
in conjunction with JS interop to receive notification when edits occur and update your .NET models.
Reopening in case this is something we choose to address in the future.
@SteveSandersonMS please look at #10087. It looks that Blazor renders incorrect HTML when we try to use contenteditable
with simple JS interop.
Hello,
if you're planning to implement contenteditable div binding, I addressed an issue few weeks ago related to this (FYI):
@SteveSandersonMS: Maybe the contenteditable div binding could resolve my issue also? There comes restrictions when I try to fetch innerHTML from the C# by using JS interop.
{Q}
Reopening in case this is something we choose to address in the future.
That would be great if this feature is supported in future releases.
Most helpful comment
Reopening in case this is something we choose to address in the future.