Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web app: add markdown publish #810

Merged
merged 1 commit into from
Jul 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/public/static/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions web/src/components/PublishDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -353,6 +358,20 @@ const PublishDialog = (props) => {
"aria-label": t("publish_dialog_message_label"),
}}
/>
<FormControlLabel
label={t("publish_dialog_checkbox_markdown")}
sx={{ marginRight: 2 }}
control={
<Checkbox
size="small"
checked={markdownEnabled}
onChange={(ev) => setMarkdownEnabled(ev.target.checked)}
inputProps={{
"aria-label": t("publish_dialog_checkbox_markdown"),
}}
/>
}
/>
<div style={{ display: "flex" }}>
<EmojiPicker anchorEl={emojiPickerAnchorEl} onEmojiPick={handleEmojiPick} onClose={handleEmojiClose} />
<DialogIconButton disabled={disabled} onClick={handleEmojiClick} aria-label={t("publish_dialog_emoji_picker_show")}>
Expand Down