Browse Source

Fixed forceToFocus

Taichi Masuyama 3 years ago
parent
commit
896ebca17e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

+ 2 - 2
packages/app/src/components/PageEditor/CodeMirrorEditor.jsx

@@ -230,10 +230,10 @@ class CodeMirrorEditor extends AbstractEditor {
    * @inheritDoc
    * @inheritDoc
    */
    */
   forceToFocus() {
   forceToFocus() {
-    const editor = this.getCodeMirror();
     // use setInterval with reluctance -- 2018.01.11 Yuki Takei
     // use setInterval with reluctance -- 2018.01.11 Yuki Takei
     const intervalId = setInterval(() => {
     const intervalId = setInterval(() => {
-      this.getCodeMirror().focus();
+      const editor = this.getCodeMirror();
+      editor.focus();
       if (editor.hasFocus()) {
       if (editor.hasFocus()) {
         clearInterval(intervalId);
         clearInterval(intervalId);
         // refresh
         // refresh