Commit 34611e5b authored by Romain Courteaud's avatar Romain Courteaud

erp5_core: editor: display read only text as code

parent e8c511f7
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
gadget = this, gadget = this,
div = document.createElement('div'), div = document.createElement('div'),
div_max = document.createElement('div'), div_max = document.createElement('div'),
code,
queue = new RSVP.Queue(); queue = new RSVP.Queue();
if ((modification_dict.hasOwnProperty('editable')) || if ((modification_dict.hasOwnProperty('editable')) ||
...@@ -199,6 +200,11 @@ ...@@ -199,6 +200,11 @@
.push(function (evt) { .push(function (evt) {
element.querySelector('img').src = evt.target.result; element.querySelector('img').src = evt.target.result;
}); });
} else if (editor_dict.hasOwnProperty(gadget.state.editor)) {
code = document.createElement('code');
code.textContent = gadget.state.value;
element.querySelector('pre').textContent = '';
element.querySelector('pre').appendChild(code);
} else { } else {
element.querySelector('pre').textContent = gadget.state.value; element.querySelector('pre').textContent = gadget.state.value;
} }
......
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