From ccb75fcf3a6057a0a09e1fcd0456654a1af1bc00 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Tue, 7 May 2024 22:23:49 +0200 Subject: [PATCH] feat(post form): replace single return with double return on submit, because markdown is mandatory on plebbit, but a user from 4chan won't know that --- src/components/post-form/post-form.tsx | 3 ++- src/components/reply-modal/reply-modal.tsx | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/post-form/post-form.tsx b/src/components/post-form/post-form.tsx index eb384f4a..b008f362 100644 --- a/src/components/post-form/post-form.tsx +++ b/src/components/post-form/post-form.tsx @@ -183,7 +183,8 @@ const PostFormTable = ({ closeForm }: { closeForm: () => void }) => { wrap='soft' ref={textRef} onChange={(e) => { - isInPostPage ? setContent.content(e.target.value) : setSubmitStore({ content: e.target.value }); + const content = e.target.value.replace(/\n/g, '\n\n'); + isInPostPage ? setContent.content(content) : setSubmitStore({ content }); }} /> diff --git a/src/components/reply-modal/reply-modal.tsx b/src/components/reply-modal/reply-modal.tsx index d992e893..0b0a069c 100644 --- a/src/components/reply-modal/reply-modal.tsx +++ b/src/components/reply-modal/reply-modal.tsx @@ -95,7 +95,10 @@ const ReplyModal = ({ closeModal, parentCid, scrollY }: ReplyModalProps) => { wrap='soft' ref={textRef} placeholder={_.capitalize(t('comment'))} - onChange={(e) => setContent.content(e.target.value)} + onChange={(e) => { + const content = e.target.value.replace(/\n/g, '\n\n'); + setContent.content(content); + }} autoFocus={!isMobile} // autofocus causes auto scroll to top on mobile />