Fix suggested title " " spaces (#2037)

* Fix imported title &nbsp spaces

* Update src/shared/components/post/post-form.tsx

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>

* Fix lint issue

---------

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
This commit is contained in:
maxime.io 2023-08-07 14:39:44 +02:00 committed by Dessalines
parent d2fce684c0
commit c303e00b27

View file

@ -581,8 +581,10 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
case "loading":
return <Spinner />;
case "success": {
const suggestedTitle = this.state.metadataRes.data.metadata.title;
// Clean up the title of any extra whitespace and replace &nbsp; with a space
const suggestedTitle = this.state.metadataRes.data.metadata.title
?.trim()
.replace(/\s+/g, " ");
return (
suggestedTitle && (
<button