Commit 9d3a35ee authored by damianofalcioni's avatar damianofalcioni

added HTML render UI plus minor refactors

parent 08b34801
......@@ -5,6 +5,7 @@
<title>Olive UI Test</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/codemirror.min.css" integrity="sha256-I8NyGs4wjbMuBSUE40o55W6k6P7tu/7G28/JGUUYCIs=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote.css" integrity="sha256-vHGOIPxeMV4uIsqGDzob0M6Zl8PY5+nJh7m0hJhJXfg=" crossorigin="anonymous" />
</head>
<body>
<!--[if IE]>
......@@ -20,15 +21,19 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/codemirror.min.js" integrity="sha256-OMbqhJ5GYA+UQ2a9UE9iXHA1kn3hlZCFL5aZmpSp/+M=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.46.0/mode/javascript/javascript.min.js" integrity="sha256-h2CaV12bheEEc7Ao3zF6MntAbDLJkPoFR+h+nHvQUqA=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote.min.js" integrity="sha256-1XDZ8T0bWi65wnqq7bBPK9QrWkE0fg6xLVAVuSqKw/4=" crossorigin="anonymous"></script>
<script src="js/OliveUI.js"></script>
<script src="js/modules/newWidgetUI.js"></script>
<script src="js/modules/newCodeEditorUI.js"></script>
<script src="js/modules/newHTMLEditorUI.js"></script>
<script src="js/modules/newMicroserviceUI.js"></script>
<script src="js/modules/newMicroserviceUI_configUI.js"></script>
<script src="js/widgets/MicroserviceUI_manifest.js"></script>
<script src="js/widgets/JavascriptRenderUI_manifest.js"></script>
<script src="js/widgets/HTMLRenderUI_manifest.js"></script>
<script src="js/main.js"></script>
</body>
......
//Main entry point!
(function (OliveUI) {
(function ($, OliveUI) {
var oliveUI = OliveUI();
......@@ -11,6 +11,7 @@
var widget1 = oliveUI.createWidgetInstance('Microservice UI');
var widget2 = oliveUI.createWidgetInstance('Microservice UI');
var widget3 = oliveUI.createWidgetInstance('Javascript Render UI');
var widget4 = oliveUI.createWidgetInstance('HTML Render UI');
oliveUI.setWidgetInstanceConfiguration(widget1, {
microserviceInputs: {
......@@ -38,4 +39,8 @@
});`
});
}(OliveUI));
oliveUI.setWidgetInstanceConfiguration(widget4, {
html: `<blockquote><b><u>tests</u></b></blockquote>`
});
}(jQuery, OliveUI));
(function (OliveUI, CodeMirror) {
(function ($, OliveUI, CodeMirror) {
'use strict';
OliveUI.modules.newCodeEditorUI = function (config = {}) {
config.mode = config.mode || 'javascript';
......@@ -41,4 +41,4 @@
}
};
};
}(OliveUI, CodeMirror));
}(jQuery, OliveUI, CodeMirror));
(function ($, OliveUI) {
'use strict';
if (!$('<div>').summernote) throw 'Summernote WYSIWYG Editor not available';
OliveUI.modules.newHTMLEditorUI = function (config = {}) {
config.height = config.minHeight || 100;
var _dom = {
rootDiv: $('<div>'),
editorDiv: $('<div>')
};
_dom.rootDiv.append(_dom.editorDiv);
_dom.editorDiv.summernote(config);
return {
render: function () {
return _dom.rootDiv;
},
setContent: function (content = {}) {
_dom.editorDiv.summernote('code', content.html || '');
},
getContent: function () {
return {
html: _dom.editorDiv.summernote('code')
};
}
};
};
}(jQuery, OliveUI));
(function (OliveUI, Utils) {
(function ($, OliveUI, Utils) {
'use strict';
var _statics = {
......@@ -84,4 +84,4 @@
OliveUI.modules.newMicroserviceUI = _newMicroserviceUI;
}(OliveUI, OliveUI.utils));
}(jQuery, OliveUI, OliveUI.utils));
(function (OliveUI, Utils, newCodeEditorUI) {
(function ($, OliveUI, Utils, newCodeEditorUI) {
'use strict';
/* newMSInputTableUI will be hided from outside */
......@@ -282,4 +282,4 @@
OliveUI.modules.newMicroserviceUI_configUI = _newMicroserviceUI_configUI;
}(OliveUI, OliveUI.utils, OliveUI.modules.newCodeEditorUI));
}(jQuery, OliveUI, OliveUI.utils, OliveUI.modules.newCodeEditorUI));
(function (OliveUI, Utils) {
(function ($, OliveUI, Utils) {
'use strict';
var _statics = {
......@@ -179,4 +179,4 @@
OliveUI.modules.newWidgetUI = _newWidgetUI;
}(OliveUI, OliveUI.utils));
}(jQuery, OliveUI, OliveUI.utils));
(function ($, OliveUI, newHTMLEditorUI) {
'use strict';
OliveUI.addWidgetManifest({
name: 'HTML Render UI',
description: '',
createUIFn: function () {
var _newHTMLRenderUI = function (config = {}) {
var _dom = {
rootDiv: $('<div>')
};
return {
render: function () {
return _dom.rootDiv;
},
setContent: function (content = {}) {
content.html = content.html || '';
_dom.rootDiv.empty();
try {
_dom.rootDiv.append($(content.html));
} catch (e) {
OliveUI.utils.showError(e, _dom.rootDiv);
}
}
};
};
return _newHTMLRenderUI();
},
createConfigurationUIFn: function () {
return newHTMLEditorUI({});
}
});
}(jQuery, OliveUI, OliveUI.modules.newHTMLEditorUI));
(function (OliveUI, newCodeEditorUI) {
(function ($, OliveUI, newCodeEditorUI) {
'use strict';
OliveUI.addWidgetManifest({
......@@ -64,4 +64,4 @@
*/
});
}(OliveUI, OliveUI.modules.newCodeEditorUI));
}(jQuery, OliveUI, OliveUI.modules.newCodeEditorUI));
(function (OliveUI, newMicroserviceUI, newMicroserviceUI_configUI) {
(function ($, OliveUI, newMicroserviceUI, newMicroserviceUI_configUI) {
'use strict';
var config = {
......@@ -42,4 +42,4 @@
//TODO: add uiCustomRenderFn configUiCustomRenderFn uiCustomGetState...
});
}(OliveUI, OliveUI.modules.newMicroserviceUI, OliveUI.modules.newMicroserviceUI_configUI));
}(jQuery, OliveUI, OliveUI.modules.newMicroserviceUI, OliveUI.modules.newMicroserviceUI_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