From d230cfe32ef711cbc0d12791214cf4c4b714b47a Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Fri, 27 Oct 2017 12:19:47 +0000
Subject: [PATCH] [erp5_core] gadget_editor: add simple compatibility with
 text_area editor

---
 .../portal_skins/erp5_core/gadget_editor.js.js      | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
index 3685590cec..e55cb08871 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_editor.js.js
@@ -76,6 +76,9 @@
                 }
               );
             });
+        } else if (gadget.state.editable &&
+            (gadget.state.editor === 'text_area')) {
+          element.appendChild(document.createElement('textarea'));
         } else {
           element.appendChild(document.createElement('pre'));
         }
@@ -90,6 +93,9 @@
           .push(function (editor_gadget) {
             return editor_gadget.render(gadget.state);
           });
+      } else if (gadget.state.editable &&
+          (gadget.state.editor === 'text_area')) {
+        element.querySelector('textarea').value = gadget.state.value;
       } else if (!gadget.state.editable &&
           (gadget.state.editor === 'fck_editor')) {
         element.innerHTML = gadget.state.value;
@@ -101,7 +107,7 @@
 
     .declareMethod('getContent', function () {
       var argument_list = arguments,
-        context = this;
+        result;
       if (this.state.editable &&
           ((this.state.editor === 'codemirror') || (this.state.editor === 'fck_editor'))) {
         return this.getDeclaredGadget('editor')
@@ -119,6 +125,11 @@
             return result;
           });
           */
+      } else if (this.state.editable &&
+          (this.state.editor === 'text_area')) {
+        result = {};
+        result[this.state.key] = this.element.querySelector('textarea').value;
+        return result;
       }
       return {};
     });
-- 
2.30.9