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
{{ message }}
Repository navigation
.setValue to work on [contenteditable=true] elements #2390
<div contenteditable> is now widely adopted as the way to make Rich text editors on the web. I've noticed that we cannot set the value of these elementes using .setValue as it throws an error, and have to resort to manual workarounds.
Solution
when field.setValue is applied and field is <div contenteditable> element, internally VTU should override Elements textContent or innerHTML prop, depending on the value of attribute value is plaintext-only or 'true'. Since this is not widely supported, just going with innerHTML is probably easier.
Activity
cexbrayat commentedon Apr 3, 2024
Hi @renatodeleao
That could be a good idea. Are you willing to open a PR that implements and documents this?
renatodeleao commentedon Apr 3, 2024
@cexbrayat sure I can draft a PR. I'll let you know.
lmiller1990 commentedon Jun 3, 2024
If there is still interest, here is how it might look:
https://github.com/lmiller1990/vuejs-composition-api-course/blob/9b203f089f924508c0d1083ecd06e54e2d75ee61/tests/unit/PostWriter.spec.ts#L16-L27
Tardigrada777 commentedon Jun 7, 2025
@cexbrayat Hey! Please, have a look on my PR attached to this issue. Looking forward to your feedback. Thanks 🙂
.
feat: support setValue() on contenteditable elements