diff --git a/js/editor.js b/js/editor.js
index 2c3ed94..ce3327b 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -62,7 +62,9 @@
           if (event.isDefaultPrevented()) {
             return;
           }
-          Drupal.editorDetach(field, Drupal.settings.editor.formats[activeEditor]);
+          if (field && Drupal.settings.editor.formats[activeEditor]) {
+            Drupal.editorDetach(field, Drupal.settings.editor.formats[activeEditor]);
+          }
         });
       });
     },
