Don't convert post content into html

This commit is contained in:
silverpill 2022-10-14 15:00:23 +00:00
parent 4ee4975172
commit 07326c3a8f
2 changed files with 5 additions and 3 deletions

View file

@ -157,6 +157,7 @@ export async function getPostContext(
export interface PostData { export interface PostData {
content: string; content: string;
content_type: string;
in_reply_to_id: string | null; in_reply_to_id: string | null;
visibility: string; visibility: string;
mentions: string[]; mentions: string[];
@ -172,6 +173,7 @@ export async function createPost(
// Convert to Mastodon API Status entity // Convert to Mastodon API Status entity
const statusData = { const statusData = {
status: postData.content, status: postData.content,
content_type: postData.content_type,
"media_ids[]": postData.attachments.map((attachment) => attachment.id), "media_ids[]": postData.attachments.map((attachment) => attachment.id),
in_reply_to_id: postData.in_reply_to_id, in_reply_to_id: postData.in_reply_to_id,
visibility: postData.visibility, visibility: postData.visibility,

View file

@ -244,10 +244,10 @@ function canPublish(): boolean {
return getCharacterCount() >= 0 && !isLoading return getCharacterCount() >= 0 && !isLoading
} }
async function publish() { async function publish(contentType = "text/markdown") {
const contentRendered = renderMarkdownLite(content)
const postData = { const postData = {
content: contentRendered, content: contentType === "text/markdown" ? content : renderMarkdownLite(content),
content_type: contentType,
in_reply_to_id: props.inReplyTo ? props.inReplyTo.id : null, in_reply_to_id: props.inReplyTo ? props.inReplyTo.id : null,
visibility: visibility, visibility: visibility,
mentions: [], mentions: [],