Commit b4907bad authored by Romain Courteaud's avatar Romain Courteaud

erp5_core: use the html_viewer when the field is non editable

parent 72704a7b
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"monaco": {"url": "monaco-editor.gadget.html"}, "monaco": {"url": "monaco-editor.gadget.html"},
"onlyoffice": {"url": "onlyoffice.gadget.html"}, "onlyoffice": {"url": "onlyoffice.gadget.html"},
"fck_editor": {"url": "ckeditor.gadget.html"}, "fck_editor": {"url": "ckeditor.gadget.html"},
"html_viewer": {"url": "gadget_html_viewer.html"},
"svg_editor" : {"url": "method-draw/method-draw.gadget.html"}, "svg_editor" : {"url": "method-draw/method-draw.gadget.html"},
"minipaint": {"url": "minipaint.gadget.html"}, "minipaint": {"url": "minipaint.gadget.html"},
"jquery-sheets": {"url": "jquery-sheets.gadget.html"}, "jquery-sheets": {"url": "jquery-sheets.gadget.html"},
...@@ -86,7 +87,9 @@ ...@@ -86,7 +87,9 @@
// for fck_editor fields, we want to be able to maximize also in non editable // for fck_editor fields, we want to be able to maximize also in non editable
if ((gadget.state.maximize && gadget.state.editable) || if ((gadget.state.maximize && gadget.state.editable) ||
(gadget.state.maximize && gadget.state.editor === 'jsmd_editor') || (gadget.state.maximize && gadget.state.editor === 'jsmd_editor') ||
(gadget.state.maximize && gadget.state.editor === 'fck_editor')) { (gadget.state.maximize &&
(gadget.state.editor === 'fck_editor') &&
gadget.state.editable)) {
element.appendChild(div_max); element.appendChild(div_max);
queue queue
.push(function () { .push(function () {
...@@ -111,7 +114,6 @@ ...@@ -111,7 +114,6 @@
if ((gadget.state.editable && if ((gadget.state.editable &&
(editor_dict.hasOwnProperty(gadget.state.editor))) || (editor_dict.hasOwnProperty(gadget.state.editor))) ||
(!gadget.state.editable && gadget.state.editor === 'fck_editor') ||
(!gadget.state.editable && gadget.state.editor === 'jsmd_editor') || (!gadget.state.editable && gadget.state.editor === 'jsmd_editor') ||
(!gadget.state.editable && gadget.state.editor === 'monaco') || (!gadget.state.editable && gadget.state.editor === 'monaco') ||
(gadget.state.editor === 'pdf')) { (gadget.state.editor === 'pdf')) {
...@@ -132,6 +134,15 @@ ...@@ -132,6 +134,15 @@
} }
); );
}); });
} else if (!gadget.state.editable &&
(gadget.state.editor === 'fck_editor')) {
queue
.push(function () {
return gadget.declareGadget(editor_dict.html_viewer.url, {
scope: 'editor',
element: div
});
});
} else if (gadget.state.editable && } else if (gadget.state.editable &&
(gadget.state.editor === 'text_area')) { (gadget.state.editor === 'text_area')) {
element.appendChild(document.createElement('textarea')); element.appendChild(document.createElement('textarea'));
...@@ -145,7 +156,7 @@ ...@@ -145,7 +156,7 @@
if ((gadget.state.editable && if ((gadget.state.editable &&
(editor_dict.hasOwnProperty(gadget.state.editor))) || (editor_dict.hasOwnProperty(gadget.state.editor))) ||
(!gadget.state.editable && gadget.state.editor === 'fck_editor') || (gadget.state.editor === 'fck_editor') ||
(!gadget.state.editable && gadget.state.editor === 'jsmd_editor') || (!gadget.state.editable && gadget.state.editor === 'jsmd_editor') ||
(!gadget.state.editable && gadget.state.editor === 'monaco') || (!gadget.state.editable && gadget.state.editor === 'monaco') ||
(gadget.state.editor === 'pdf')) { (gadget.state.editor === 'pdf')) {
......
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