Dispatch oninput manually when textarea value change

I thought… React/Preact should do this automagically…
This commit is contained in:
Lim Chee Aun 2022-12-14 22:54:12 +08:00
parent 735cbf05b7
commit b0372ea83b

View file

@ -112,6 +112,7 @@ function Compose({
expiresIn: poll?.expiresIn || expiresInFromExpiresAt(poll.expiresAt),
};
textareaRef.current.value = status;
textareaRef.current.dispatchEvent(new Event('input'));
spoilerTextRef.current.value = spoilerText;
setVisibility(visibility);
setSensitive(sensitive);
@ -131,6 +132,7 @@ function Compose({
console.log({ statusSource });
const { text, spoilerText } = statusSource;
textareaRef.current.value = text;
textareaRef.current.dispatchEvent(new Event('input'));
textareaRef.current.dataset.source = text;
spoilerTextRef.current.value = spoilerText;
setVisibility(visibility);