Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor ContentEditable data binding

$
0
0

I know that Blazor does not support data-binding for contenteditable div. What I have working is the following that allows text to be written and accessed through onInput.

<div role="textbox" contentEditable="true" @oninput="(e) => HandleInput(e, item.TODO_ID)">@item.TODO_TEXT</div>

The issue is I can't figure out how to update TODO_TEXT with this new text. Anyone has any workarounds to suggest? Even recommendations for other controls that would support markup text.

Note: The above uses JSInterop code from here to ensure that any edits are passed along through oninput:

document.addEventListener("input", onInput);function onInput(e) { let target = e.target; if (target.localName == "div") {   if (!target.value && !target.__contenteditable) target.__contenteditable = true;   if (target.__contenteditable) target.value = target.innerText; }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>