@@ -74,8 +74,14 @@ export default class MessageComposerInput extends React.Component {
7474 this . handleKeyCommand = this . handleKeyCommand . bind ( this ) ;
7575 this . onChange = this . onChange . bind ( this ) ;
7676
77+ let isRichtextEnabled = window . localStorage . getItem ( 'mx_editor_rte_enabled' ) ;
78+ if ( isRichtextEnabled == null ) {
79+ isRichtextEnabled = 'true' ;
80+ }
81+ isRichtextEnabled = isRichtextEnabled === 'true' ;
82+
7783 this . state = {
78- isRichtextEnabled : false , // TODO enable by default when RTE is mature enough
84+ isRichtextEnabled : isRichtextEnabled ,
7985 editorState : null
8086 } ;
8187
@@ -104,11 +110,14 @@ export default class MessageComposerInput extends React.Component {
104110 RichText . getScopedMDDecorators ( this . props ) ,
105111 compositeDecorator = new CompositeDecorator ( decorators ) ;
106112
113+ let editorState = null ;
107114 if ( contentState ) {
108- return EditorState . createWithContent ( contentState , compositeDecorator ) ;
115+ editorState = EditorState . createWithContent ( contentState , compositeDecorator ) ;
109116 } else {
110- return EditorState . createEmpty ( compositeDecorator ) ;
117+ editorState = EditorState . createEmpty ( compositeDecorator ) ;
111118 }
119+
120+ return EditorState . moveFocusToEnd ( editorState ) ;
112121 }
113122
114123 componentWillMount ( ) {
@@ -359,6 +368,8 @@ export default class MessageComposerInput extends React.Component {
359368 } ) ;
360369 }
361370
371+ window . localStorage . setItem ( 'mx_editor_rte_enabled' , enabled ) ;
372+
362373 this . setState ( {
363374 isRichtextEnabled : enabled
364375 } ) ;
0 commit comments