From c8f880c701038822e639a7fd686ed172e468bbed Mon Sep 17 00:00:00 2001 From: Nihal Gonsalves Date: Sun, 9 Jul 2023 10:28:07 +0200 Subject: [PATCH] =?UTF-8?q?Web=20app:=20add=20a=20=E2=80=9Cpublish=20as=20?= =?UTF-8?q?markdown=E2=80=9D=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/public/static/langs/en.json | 1 + web/src/components/PublishDialog.jsx | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/web/public/static/langs/en.json b/web/public/static/langs/en.json index 3f2947e4..3ad04ea7 100644 --- a/web/public/static/langs/en.json +++ b/web/public/static/langs/en.json @@ -160,6 +160,7 @@ "publish_dialog_button_cancel_sending": "Cancel sending", "publish_dialog_button_cancel": "Cancel", "publish_dialog_button_send": "Send", + "publish_dialog_checkbox_markdown": "Format as Markdown", "publish_dialog_checkbox_publish_another": "Publish another", "publish_dialog_attached_file_title": "Attached file:", "publish_dialog_attached_file_filename_placeholder": "Attachment filename", diff --git a/web/src/components/PublishDialog.jsx b/web/src/components/PublishDialog.jsx index 6cea1a9c..f18eec8d 100644 --- a/web/src/components/PublishDialog.jsx +++ b/web/src/components/PublishDialog.jsx @@ -61,6 +61,7 @@ const PublishDialog = (props) => { const [call, setCall] = useState(""); const [delay, setDelay] = useState(""); const [publishAnother, setPublishAnother] = useState(false); + const [markdownEnabled, setMarkdownEnabled] = useState(false); const [showTopicUrl, setShowTopicUrl] = useState(""); const [showClickUrl, setShowClickUrl] = useState(false); @@ -148,6 +149,10 @@ const PublishDialog = (props) => { if (attachFile && message.trim()) { url.searchParams.append("message", message.replaceAll("\n", "\\n").trim()); } + if (markdownEnabled) { + url.searchParams.append("markdown", "true"); + } + const body = attachFile || message; try { const user = await userManager.get(baseUrl); @@ -353,6 +358,20 @@ const PublishDialog = (props) => { "aria-label": t("publish_dialog_message_label"), }} /> + setMarkdownEnabled(ev.target.checked)} + inputProps={{ + "aria-label": t("publish_dialog_checkbox_markdown"), + }} + /> + } + />