null-guard history properly
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
265e4267b8
commit
f264075369
1 changed files with 8 additions and 10 deletions
|
@ -1255,16 +1255,14 @@ export default class MessageComposerInput extends React.Component {
|
|||
|
||||
let editorState;
|
||||
const historyItem = this.historyManager.getItem(delta);
|
||||
if (historyItem) {
|
||||
if (historyItem.format === 'rich' && !this.state.isRichTextEnabled) {
|
||||
editorState = this.richToMdEditorState(historyItem.value);
|
||||
}
|
||||
else if (historyItem.format === 'markdown' && this.state.isRichTextEnabled) {
|
||||
editorState = this.mdToRichEditorState(historyItem.value);
|
||||
}
|
||||
else {
|
||||
editorState = historyItem.value;
|
||||
}
|
||||
if (!historyItem) return;
|
||||
|
||||
if (historyItem.format === 'rich' && !this.state.isRichTextEnabled) {
|
||||
editorState = this.richToMdEditorState(historyItem.value);
|
||||
} else if (historyItem.format === 'markdown' && this.state.isRichTextEnabled) {
|
||||
editorState = this.mdToRichEditorState(historyItem.value);
|
||||
} else {
|
||||
editorState = historyItem.value;
|
||||
}
|
||||
|
||||
// Move selection to the end of the selected history
|
||||
|
|
Loading…
Reference in a new issue