From: maxime.io Date: Mon, 7 Aug 2023 12:39:44 +0000 (+0200) Subject: Fix suggested title " " spaces (#2037) X-Git-Url: http://these/git/%7BdocsUrl%7D?a=commitdiff_plain;h=76a656bc5b77e329d66551d2d2c7660dd3c469da;p=lemmy-ui.git Fix suggested title " " spaces (#2037) * Fix imported title   spaces * Update src/shared/components/post/post-form.tsx Co-authored-by: SleeplessOne1917 * Fix lint issue --------- Co-authored-by: SleeplessOne1917 --- diff --git a/src/shared/components/post/post-form.tsx b/src/shared/components/post/post-form.tsx index 6c88628..7b37926 100644 --- a/src/shared/components/post/post-form.tsx +++ b/src/shared/components/post/post-form.tsx @@ -582,8 +582,10 @@ export class PostForm extends Component { case "loading": return ; case "success": { - const suggestedTitle = this.state.metadataRes.data.metadata.title; - + // Clean up the title of any extra whitespace and replace   with a space + const suggestedTitle = this.state.metadataRes.data.metadata.title + ?.trim() + .replace(/\s+/g, " "); return ( suggestedTitle && (