Save draft while typing

This commit is contained in:
Bojan Mojsilovic 2024-02-02 12:39:33 +01:00
parent af2fc9ac76
commit e665562db7

View File

@ -578,7 +578,7 @@ const EditBox: Component<{
const [isPostingInProgress, setIsPostingInProgress] = createSignal(false);
const postNote = async () => {
if (!account || !account.hasPublicKey() || fileToUpload() || isInputting()) {
if (!account || !account.hasPublicKey() || fileToUpload()) {
return;
}
@ -997,19 +997,20 @@ const EditBox: Component<{
return content;
};
const [isInputting, setIsInputting] = createSignal(false);
const onInput = (e: InputEvent) => {
if (fileToUpload()) {
e.preventDefault();
return false;
}
setIsInputting(true);
// debounce(() => {
setIsInputting(false);
textArea && setMessage(textArea.value)
// }, 500)
if (textArea) {
textArea && setMessage(textArea.value);
// save draft just in case there is an unintended interuption
saveNoteDraft(account?.publicKey, textArea?.value, props.replyToNote?.post.noteId);
}
};
let delayForMedia = 0;