 js/ckeditor.js                                     |    9 +++++--
 .../ckeditor/Plugin/editor/editor/CKEditor.php     |   26 ++++++++++----------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/js/ckeditor.js b/js/ckeditor.js
index 4254da0..8624477 100644
--- a/js/ckeditor.js
+++ b/js/ckeditor.js
@@ -7,10 +7,15 @@ Drupal.editors.ckeditor = {
     this._loadExternalPlugins(format);
     return !!CKEDITOR.replace(element, format.editorSettings);
   },
-  detach: function (element, format) {
+  detach: function (element, format, trigger) {
     var editor = CKEDITOR.dom.element.get(element).getEditor();
     if (editor) {
-      editor.destroy();
+      if (trigger === 'serialize') {
+        editor.updateElement();
+      }
+      else {
+        editor.destroy();
+      }
     }
     return !!editor;
   },
diff --git a/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php b/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php
index d28cd0b..d8bf9d7 100644
--- a/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php
+++ b/lib/Drupal/ckeditor/Plugin/editor/editor/CKEditor.php
@@ -7,11 +7,10 @@
 
 namespace Drupal\ckeditor\Plugin\editor\editor;
 
-use Drupal\Component\Plugin\PluginBase;
+use Drupal\editor\Plugin\EditorBase;
 use Drupal\Core\Annotation\Plugin;
 use Drupal\Core\Annotation\Translation;
 use Drupal\editor\Plugin\Core\Entity\Editor;
-use Drupal\editor\Plugin\EditorInterface;
 
 
 
@@ -20,19 +19,20 @@ use Drupal\editor\Plugin\EditorInterface;
  *
  * @Plugin(
  *   id = "ckeditor",
- *   title = @Translation("CKEditor"),
+ *   label = @Translation("CKEditor"),
   *  library = {
  *     "module" = "ckeditor",
  *     "name" = "drupal.ckeditor"
- *   }
+ *   },
+ *   module = "ckeditor"
  * )
  */
-class CKEditor extends PluginBase implements EditorInterface {
+class CKEditor extends EditorBase {
 
   /**
-   * Implements \Drupal\editor\Plugin\EditorInterface::defaultSettings().
+   * Implements \Drupal\editor\Plugin\EditorInterface::getDefaultSettings().
    */
-  function defaultSettings() {
+  function getDefaultSettings() {
     return array(
       'toolbar' => array(
         array(
@@ -50,7 +50,7 @@ class CKEditor extends PluginBase implements EditorInterface {
   /**
    * Implements \Drupal\editor\Plugin\EditorInterface::settingsForm().
    */
-  function settingsForm(array &$form, array &$form_state, Editor $editor) {
+  function settingsForm(array $form, array &$form_state, Editor $editor) {
     $module_path = drupal_get_path('module', 'ckeditor');
     $plugins = ckeditor_plugins();
 
@@ -94,19 +94,19 @@ class CKEditor extends PluginBase implements EditorInterface {
    */
   function settingsFormValidate(array $form, array &$form_state) {
     $settings = $form_state['values']['editor_settings'];
-    form_set_value($form['editor_settings']['toolbar']['toolbar'], json_decode($settings['toolbar'], FALSE), $form_state);
+    form_set_value($form['toolbar']['toolbar'], json_decode($form['toolbar']['toolbar']['#value'], FALSE), $form_state);
 
     $format_list = array();
-    foreach (explode(',', $settings['format_list']) as $format) {
+    foreach (explode(',', $form['toolbar']['format_list']['#value']) as $format) {
       $format_list[] = trim($format);
     }
-    form_set_value($form['editor_settings']['toolbar']['format_list'], $format_list, $form_state);
+    form_set_value($form['toolbar']['format_list'], $format_list, $form_state);
 
     $styles = array();
-    foreach (explode("\n", $settings['style_list']) as $style) {
+    foreach (explode("\n", $form['toolbar']['style_list']['#value']) as $style) {
       $styles[] = trim($style);
     }
-    form_set_value($form['editor_settings']['toolbar']['style_list'], $styles, $form_state);
+    form_set_value($form['toolbar']['style_list'], $styles, $form_state);
   }
 
   /**
