title: How to move the cursor to the end of the line?
body: <p>I am using draft.js to develop a Rich text editor. I want the user to be able to keep typing once the Italic button is clicked. And inline styling should be applied until the user disable the italic button. Clicking on the button make the cursor to focus out of the editor. I created a ref and called the <code>focus()</code> function on  the current ref and then called <code>moveFocusToEnd</code> on on <code>edotorState</code>. This does not work as expected. How do I achieve this behavior?</p>
  
  <p><strong>ReactJS</strong></p>
  
  <pre><code>import React from 'react';
  import { Editor, EditorState, RichUtils } from 'draft-js';
  import { Button, Icon } from 'antd';
  
  function MyEditor() {
  
    const ref = React.useRef(null);
  
    const [editorState, setEditorState] = React.useState(
      EditorState.createEmpty()
    );
  
    const handleKeyCommand = command =&gt; {
      const newState = RichUtils.handleKeyCommand(editorState, command);
  
      if (newState) {
        setEditorState(newState)
        return "handled"
      }
  
      return "not-handled";
  
    }
  
    const onItalicClick = event =&gt; {
      ref.current.focus()
      EditorState.moveFocusToEnd(editorState)
      setEditorState(RichUtils.toggleInlineStyle(editorState, 'ITALIC'))
    }
  
    const onUnderLinkClick = event =&gt; {
      event.preventDefault()
      setEditorState(RichUtils.toggleInlineStyle(editorState, "UNDERLINE"))
    }
  
    const onBoldClick = event =&gt; {
      event.preventDefault()
      console.log(event)
      setEditorState(RichUtils.toggleInlineStyle(editorState, "BOLD"))
    }
  
    return &lt;div&gt;
      &lt;div&gt;
        &lt;Button
          onClick={onItalicClick}
        &gt;
          &lt;Icon type="italic" /&gt;
        &lt;/Button&gt;
        &lt;Button
          onClick={onUnderLinkClick}
        &gt;
          &lt;Icon type="underline" /&gt;
        &lt;/Button&gt;
        &lt;Button
          onClick={onBoldClick}
        &gt;
          &lt;Icon type="bold" /&gt;
        &lt;/Button&gt;
      &lt;/div&gt;
      &lt;Editor
        editorState={editorState}
        onChange={editorState =&gt; setEditorState(editorState)}
        handleKeyCommand={handleKeyCommand}
        ref={ref}
      /&gt;
    &lt;/div&gt;;
  
  }
  
  export default MyEditor;
  </code></pre>
  
  <p><strong>SCSS</strong></p>
  
  <pre><code>.wrapper {
    border: 1px solid #e2e2e2;
    padding: 10px;
    margin-bottom: 20px;
  } 
  </code></pre>