Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
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
22 changes: 12 additions & 10 deletions src/components/message/editingBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ type State = {
};

const EditingChatInput = (props: Props) => {
const initialState =
props.message.messageType === 'text'
? props.message.content.body
: stateToMarkdown(
toState(JSON.parse(props.message.content.body)).getCurrentContent(),
{
gfm: true,
}
// NOTE(@mxstbr): draft-js-export-markdown sometimes appends an empty line at the end,
// which we really never want
).replace(/\n$/, '');
// $FlowIssue
const [text, setText] = React.useState(
stateToMarkdown(
toState(JSON.parse(props.message.content.body)).getCurrentContent(),
{
gfm: true,
}
// NOTE(@mxstbr): draft-js-export-markdown sometimes appends an empty line at the end,
// which we really never want
).replace(/\n$/, '')
);
const [text, setText] = React.useState(initialState);
// $FlowIssue
const [saving, setSaving] = React.useState(false);

Expand Down