Commit 08b34801 authored by damianofalcioni's avatar damianofalcioni

JavascriptRenderUI_manifest.js refactoring

parent 4c4584fa
......@@ -9,23 +9,21 @@
createUIFn: function () {
var _newJavascriptRenderUI = function (config = {}) {
var _dom = {
messageDiv: $('<div>'),
outputDiv: $('<div>')
rootDiv: $('<div>')
};
return {
render: function () {
return $('<div>').append(
_dom.messageDiv,
_dom.outputDiv);
return _dom.rootDiv;
},
setContent: function (content = {}) {
content.javascriptAlg = content.javascriptAlg || '';
content.javascriptAlg = content.javascriptAlg || 'return "";';
_dom.rootDiv.empty();
try {
var algF = new Function(content.javascriptAlg + '\n//# sourceURL=' + OliveUI.utils.generateUUID() + '.js');
var domOut = algF();
_dom.outputDiv.empty().append(domOut);
_dom.rootDiv.append(domOut);
} catch (e) {
OliveUI.utils.showError(e, _dom.messageDiv);
OliveUI.utils.showError(e, _dom.rootDiv);
}
}
};
......@@ -34,32 +32,21 @@
},
createConfigurationUIFn: function () {
var _newJavascriptRenderUI_configUI = function (config = {}) {
var _dom = {
rootNode: $('<div>')
};
var _sub = {
codeEditor: newCodeEditorUI({})
};
var _newJavascriptRenderUI_configUI = function () {
var codeEditor = newCodeEditorUI({});
return {
getContent: function () {
return {
javascriptAlg: _sub.codeEditor.getContent().text
javascriptAlg: codeEditor.getContent().text
};
},
setContent: function (content = {}) {
_sub.codeEditor.setContent({
codeEditor.setContent({
text: content.javascriptAlg || '//Javascript algoritm that "return" a DOM object.\n'
});
},
render: function () {
return _dom.rootNode.empty().append(
_sub.codeEditor.render()
);
},
refresh: function () {
_sub.codeEditor.refresh();
}
render: codeEditor.render,
refresh: codeEditor.refresh
};
};
return _newJavascriptRenderUI_configUI();
......
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