Commit d230cfe3 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_core] gadget_editor: add simple compatibility with text_area editor

parent d0f9374e
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
} }
); );
}); });
} else if (gadget.state.editable &&
(gadget.state.editor === 'text_area')) {
element.appendChild(document.createElement('textarea'));
} else { } else {
element.appendChild(document.createElement('pre')); element.appendChild(document.createElement('pre'));
} }
...@@ -90,6 +93,9 @@ ...@@ -90,6 +93,9 @@
.push(function (editor_gadget) { .push(function (editor_gadget) {
return editor_gadget.render(gadget.state); 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 && } else if (!gadget.state.editable &&
(gadget.state.editor === 'fck_editor')) { (gadget.state.editor === 'fck_editor')) {
element.innerHTML = gadget.state.value; element.innerHTML = gadget.state.value;
...@@ -101,7 +107,7 @@ ...@@ -101,7 +107,7 @@
.declareMethod('getContent', function () { .declareMethod('getContent', function () {
var argument_list = arguments, var argument_list = arguments,
context = this; result;
if (this.state.editable && if (this.state.editable &&
((this.state.editor === 'codemirror') || (this.state.editor === 'fck_editor'))) { ((this.state.editor === 'codemirror') || (this.state.editor === 'fck_editor'))) {
return this.getDeclaredGadget('editor') return this.getDeclaredGadget('editor')
...@@ -119,6 +125,11 @@ ...@@ -119,6 +125,11 @@
return result; 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 {}; return {};
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment