Web app: add a “publish as markdown” option
This commit is contained in:
		
							parent
							
								
									f2d3f0bdf9
								
							
						
					
					
						commit
						c8f880c701
					
				
					 2 changed files with 20 additions and 0 deletions
				
			
		|  | @ -160,6 +160,7 @@ | ||||||
|   "publish_dialog_button_cancel_sending": "Cancel sending", |   "publish_dialog_button_cancel_sending": "Cancel sending", | ||||||
|   "publish_dialog_button_cancel": "Cancel", |   "publish_dialog_button_cancel": "Cancel", | ||||||
|   "publish_dialog_button_send": "Send", |   "publish_dialog_button_send": "Send", | ||||||
|  |   "publish_dialog_checkbox_markdown": "Format as Markdown", | ||||||
|   "publish_dialog_checkbox_publish_another": "Publish another", |   "publish_dialog_checkbox_publish_another": "Publish another", | ||||||
|   "publish_dialog_attached_file_title": "Attached file:", |   "publish_dialog_attached_file_title": "Attached file:", | ||||||
|   "publish_dialog_attached_file_filename_placeholder": "Attachment filename", |   "publish_dialog_attached_file_filename_placeholder": "Attachment filename", | ||||||
|  |  | ||||||
|  | @ -61,6 +61,7 @@ const PublishDialog = (props) => { | ||||||
|   const [call, setCall] = useState(""); |   const [call, setCall] = useState(""); | ||||||
|   const [delay, setDelay] = useState(""); |   const [delay, setDelay] = useState(""); | ||||||
|   const [publishAnother, setPublishAnother] = useState(false); |   const [publishAnother, setPublishAnother] = useState(false); | ||||||
|  |   const [markdownEnabled, setMarkdownEnabled] = useState(false); | ||||||
| 
 | 
 | ||||||
|   const [showTopicUrl, setShowTopicUrl] = useState(""); |   const [showTopicUrl, setShowTopicUrl] = useState(""); | ||||||
|   const [showClickUrl, setShowClickUrl] = useState(false); |   const [showClickUrl, setShowClickUrl] = useState(false); | ||||||
|  | @ -148,6 +149,10 @@ const PublishDialog = (props) => { | ||||||
|     if (attachFile && message.trim()) { |     if (attachFile && message.trim()) { | ||||||
|       url.searchParams.append("message", message.replaceAll("\n", "\\n").trim()); |       url.searchParams.append("message", message.replaceAll("\n", "\\n").trim()); | ||||||
|     } |     } | ||||||
|  |     if (markdownEnabled) { | ||||||
|  |       url.searchParams.append("markdown", "true"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const body = attachFile || message; |     const body = attachFile || message; | ||||||
|     try { |     try { | ||||||
|       const user = await userManager.get(baseUrl); |       const user = await userManager.get(baseUrl); | ||||||
|  | @ -353,6 +358,20 @@ const PublishDialog = (props) => { | ||||||
|               "aria-label": t("publish_dialog_message_label"), |               "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" }}> |           <div style={{ display: "flex" }}> | ||||||
|             <EmojiPicker anchorEl={emojiPickerAnchorEl} onEmojiPick={handleEmojiPick} onClose={handleEmojiClose} /> |             <EmojiPicker anchorEl={emojiPickerAnchorEl} onEmojiPick={handleEmojiPick} onClose={handleEmojiClose} /> | ||||||
|             <DialogIconButton disabled={disabled} onClick={handleEmojiClick} aria-label={t("publish_dialog_emoji_picker_show")}> |             <DialogIconButton disabled={disabled} onClick={handleEmojiClick} aria-label={t("publish_dialog_emoji_picker_show")}> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue