Merge pull request #2682 from jryans/simplify-composer-state-change
Remove duplicated conversion from `enableRichText`pull/21833/head
commit
150c941340
|
@ -685,17 +685,14 @@ export default class MessageComposerInput extends React.Component {
|
||||||
enableRichtext(enabled: boolean) {
|
enableRichtext(enabled: boolean) {
|
||||||
if (enabled === this.state.isRichTextEnabled) return;
|
if (enabled === this.state.isRichTextEnabled) return;
|
||||||
|
|
||||||
let editorState = null;
|
|
||||||
if (enabled) {
|
|
||||||
editorState = this.mdToRichEditorState(this.state.editorState);
|
|
||||||
} else {
|
|
||||||
editorState = this.richToMdEditorState(this.state.editorState);
|
|
||||||
}
|
|
||||||
|
|
||||||
Analytics.setRichtextMode(enabled);
|
Analytics.setRichtextMode(enabled);
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editorState: this.createEditorState(enabled, editorState),
|
editorState: this.createEditorState(
|
||||||
|
enabled,
|
||||||
|
this.state.editorState,
|
||||||
|
this.state.isRichTextEnabled,
|
||||||
|
),
|
||||||
isRichTextEnabled: enabled,
|
isRichTextEnabled: enabled,
|
||||||
}, () => {
|
}, () => {
|
||||||
this._editor.focus();
|
this._editor.focus();
|
||||||
|
|
Loading…
Reference in New Issue